Finish config mapping

This commit is contained in:
Ben Sarmiento
2023-10-19 18:02:30 +02:00
parent ce0b2445b2
commit faba4e53ab
14 changed files with 397 additions and 89 deletions

View File

@@ -1,6 +1,7 @@
package dav
import (
"log"
"path/filepath"
"github.com/debridmediamanager.com/zurg/internal/torrent"
@@ -47,6 +48,12 @@ func createSingleTorrentResponse(basePath string, torrents []torrent.Torrent, t
var torrentResponses []dav.Response
for _, torrent := range torrents {
for _, file := range torrent.SelectedFiles {
if file.Link == "" {
// TODO: trigger a re-add for the file
log.Println("File has no link, skipping", file.Path)
t.RefreshInfo(torrent.ID)
continue
}
filename := filepath.Base(file.Path)
fragment := davextra.GetLinkFragment(file.Link)
filename = davextra.InsertLinkFragment(filename, fragment)