Rename and only return 404 when not found

This commit is contained in:
Ben Adrian Sarmiento
2024-07-19 00:26:11 +02:00
parent f6b6ae113e
commit eaabd20a83
2 changed files with 86 additions and 89 deletions

View File

@@ -51,7 +51,7 @@ func ServeGroupDirectory(directory string, torMgr *torrent.TorrentManager) ([]by
return buf.Bytes(), nil
}
func ServeFilesList(directory, torrentName string, torMgr *torrent.TorrentManager, shouldHideBrokenTorrents bool) ([]byte, error) {
func ServeTorrentFiles(directory, torrentName string, torMgr *torrent.TorrentManager, shouldHideBrokenTorrents bool) ([]byte, error) {
torrents, ok := torMgr.DirectoryMap.Get(directory)
if !ok {
return nil, fmt.Errorf("cannot find directory %s", directory)
@@ -94,7 +94,7 @@ func ServeFilesList(directory, torrentName string, torMgr *torrent.TorrentManage
return buf.Bytes(), nil
}
func ServeDownloadsList(_ string, torMgr *torrent.TorrentManager) ([]byte, error) {
func ServeDownloads(_ string, torMgr *torrent.TorrentManager) ([]byte, error) {
var buf bytes.Buffer
buf.WriteString("<ol>")
filenames := torMgr.DownloadMap.Keys()