Create a torrentMap
This commit is contained in:
@@ -15,8 +15,7 @@ import (
|
||||
)
|
||||
|
||||
func HandlePropfindRequest(w http.ResponseWriter, r *http.Request, t *torrent.TorrentManager, c config.ConfigInterface, cache *expirable.LRU[string, string]) {
|
||||
rlog := logutil.NewLogger()
|
||||
log := rlog.Named("dav")
|
||||
log := logutil.NewLogger().Named("dav")
|
||||
|
||||
requestPath := path.Clean(r.URL.Path)
|
||||
requestPath = strings.Trim(requestPath, "/")
|
||||
|
||||
@@ -18,12 +18,12 @@ func createMultiTorrentResponse(basePath string, torrents []torrent.Torrent) (*d
|
||||
if item.Progress != 100 {
|
||||
continue
|
||||
}
|
||||
if _, exists := seen[item.Name]; exists {
|
||||
if _, exists := seen[item.AccessKey]; exists {
|
||||
continue
|
||||
}
|
||||
seen[item.Name] = true
|
||||
seen[item.AccessKey] = true
|
||||
|
||||
path := filepath.Join(basePath, item.Name)
|
||||
path := filepath.Join(basePath, item.AccessKey)
|
||||
responses = append(responses, dav.Directory(path))
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ func createSingleTorrentResponse(basePath string, torrents []torrent.Torrent) (*
|
||||
var responses []dav.Response
|
||||
|
||||
// initial response is the directory itself
|
||||
currentPath := filepath.Join(basePath, torrents[0].Name)
|
||||
currentPath := filepath.Join(basePath, torrents[0].AccessKey)
|
||||
responses = append(responses, dav.Directory(currentPath))
|
||||
|
||||
finalName := make(map[string]bool)
|
||||
|
||||
Reference in New Issue
Block a user