Refactor delete

This commit is contained in:
Ben Adrian Sarmiento
2024-06-25 20:22:34 +02:00
parent c1fdd9f5d1
commit e4650a0f0f
2 changed files with 9 additions and 9 deletions

View File

@@ -36,13 +36,13 @@ func HandleDeleteFile(directory, torrentName, fileName string, torMgr *torrent.T
dirCfg := torMgr.Config.(*config.ZurgConfigV1).GetDirectoryConfig(directory)
if dirCfg.OnlyShowTheBiggestFile {
torMgr.Delete(torrentName, true)
} else {
if err := file.State.Event(context.Background(), "delete_file"); err != nil {
return fmt.Errorf("cannot delete file %s: %v", fileName, err)
}
if torMgr.CheckDeletedStatus(torrent) {
torMgr.Delete(torrentName, true)
}
return nil
}
if err := file.State.Event(context.Background(), "delete_file"); err != nil {
return fmt.Errorf("cannot delete file %s: %v", fileName, err)
}
if torMgr.CheckDeletedStatus(torrent) {
torMgr.Delete(torrentName, true)
}
return nil
}