Fix http mount issues

This commit is contained in:
Ben Sarmiento
2024-01-09 00:24:53 +01:00
parent 6c4c73a5b0
commit eb3f2785ce
4 changed files with 36 additions and 9 deletions

View File

@@ -100,7 +100,13 @@ func ServeDownloadsListForInfuse(torMgr *torrent.TorrentManager) ([]byte, error)
return buf.Bytes(), nil
}
buf.WriteString("<?xml version=\"1.0\" encoding=\"utf-8\"?><d:multistatus xmlns:d=\"DAV:\">")
for _, download := range torMgr.DownloadCache.Items() {
filenames := torMgr.DownloadMap.Keys()
sort.Strings(filenames)
for _, filename := range filenames {
download, ok := torMgr.DownloadMap.Get(filename)
if !ok || !strings.HasPrefix(download.Link, "http") {
continue
}
buf.WriteString(dav.File(download.Filename, download.Filesize, download.Generated))
}
buf.WriteString("</d:multistatus>")