proper marking of file as deleted
This commit is contained in:
@@ -79,11 +79,16 @@ func Setup(app *aero.Application, c config.ConfigInterface, t *torrent.TorrentMa
|
||||
}
|
||||
|
||||
filenameV2, linkFragment := davextra.ExtractLinkFragment(filename)
|
||||
link := getLink(torrents, filenameV2, linkFragment)
|
||||
if link == "" {
|
||||
torrent, file := getFile(torrents, filenameV2, linkFragment)
|
||||
if file == nil {
|
||||
log.Println("Cannot find file", filename)
|
||||
return ctx.Error(http.StatusNotFound, "Cannot find file")
|
||||
}
|
||||
if file.Link == "" {
|
||||
log.Println("Link not found", filename)
|
||||
return ctx.Error(http.StatusNotFound, "Cannot find file")
|
||||
}
|
||||
link := file.Link
|
||||
|
||||
unrestrictFn := func() (*realdebrid.UnrestrictResponse, error) {
|
||||
return realdebrid.UnrestrictLink(c.GetToken(), link)
|
||||
@@ -94,6 +99,7 @@ func Setup(app *aero.Application, c config.ConfigInterface, t *torrent.TorrentMa
|
||||
// when unrestricting fails, it means the file is not available anymore
|
||||
// if it's the only file, tough luck
|
||||
log.Println("Cannot unrestrict link", link, filenameV2)
|
||||
t.MarkFileAsDeleted(torrent, file)
|
||||
return ctx.Error(http.StatusNotFound, "Cannot find file")
|
||||
}
|
||||
if resp.Filename != filenameV2 {
|
||||
|
||||
Reference in New Issue
Block a user