A lot of fixes: filenames, dupes in directories, dupes in torrents
This commit is contained in:
@@ -5,7 +5,6 @@ import (
|
||||
|
||||
"github.com/debridmediamanager.com/zurg/internal/torrent"
|
||||
"github.com/debridmediamanager.com/zurg/pkg/dav"
|
||||
"github.com/debridmediamanager.com/zurg/pkg/davextra"
|
||||
)
|
||||
|
||||
// createMultiTorrentResponse creates a WebDAV response for a list of torrents
|
||||
@@ -43,7 +42,6 @@ func createSingleTorrentResponse(basePath string, torrents []torrent.Torrent) (*
|
||||
currentPath := filepath.Join(basePath, torrents[0].Name)
|
||||
responses = append(responses, dav.Directory(currentPath))
|
||||
|
||||
nameAndLink := make(map[string]bool)
|
||||
finalName := make(map[string]bool)
|
||||
|
||||
var torrentResponses []dav.Response
|
||||
@@ -56,16 +54,10 @@ func createSingleTorrentResponse(basePath string, torrents []torrent.Torrent) (*
|
||||
}
|
||||
|
||||
filename := filepath.Base(file.Path)
|
||||
key := filename + file.Link
|
||||
|
||||
if nameAndLink[key] {
|
||||
continue
|
||||
}
|
||||
nameAndLink[key] = true
|
||||
|
||||
if finalName[filename] {
|
||||
fragment := davextra.GetLinkFragment(file.Link)
|
||||
filename = davextra.InsertLinkFragment(filename, fragment)
|
||||
// fragment := davextra.GetLinkFragment(file.Link)
|
||||
// filename = davextra.InsertLinkFragment(filename, fragment)
|
||||
continue
|
||||
}
|
||||
finalName[filename] = true
|
||||
|
||||
|
||||
Reference in New Issue
Block a user