Reimplement deletes and marking files as broken

This commit is contained in:
Ben Sarmiento
2024-01-29 22:28:27 +01:00
parent 1615c9e121
commit b505400f60
12 changed files with 64 additions and 112 deletions

View File

@@ -74,8 +74,8 @@ func ServeFilesList(directory, torrentName string, torMgr *torrent.TorrentManage
filenames := tor.SelectedFiles.Keys()
sort.Strings(filenames)
for _, filename := range filenames {
file, ok := tor.SelectedFiles.Get(filename)
if !ok || !strings.HasPrefix(file.Link, "http") {
file, _ := tor.SelectedFiles.Get(filename)
if file.IsDeleted {
continue
}
if dirCfg.OnlyShowTheBiggestFile && file.Bytes < biggestFileSize {
@@ -104,7 +104,7 @@ func ServeDownloadsList(torMgr *torrent.TorrentManager) ([]byte, error) {
sort.Strings(filenames)
for _, filename := range filenames {
download, ok := torMgr.DownloadMap.Get(filename)
if !ok || !strings.HasPrefix(download.Link, "http") {
if !ok {
continue
}
filePath := filepath.Join(config.DOWNLOADS, url.PathEscape(filename))