Fix filename mismatch
This commit is contained in:
@@ -64,10 +64,11 @@ func (dl *Downloader) DownloadFile(directory, torrentName, fileName string, resp
|
||||
http.Error(resp, "File is not available", http.StatusNotFound)
|
||||
return
|
||||
} else {
|
||||
if unrestrict.Filename != fileName {
|
||||
unrestrictFilename := strings.TrimPrefix(unrestrict.Filename, "/")
|
||||
if !strings.Contains(fileName, unrestrictFilename) {
|
||||
// this is possible if there's only 1 streamable file in the torrent
|
||||
// and then suddenly it's a rar file
|
||||
actualExt := filepath.Ext(unrestrict.Filename)
|
||||
actualExt := filepath.Ext(unrestrictFilename)
|
||||
expectedExt := filepath.Ext(fileName)
|
||||
if actualExt != expectedExt && unrestrict.Streamable != 1 {
|
||||
log.Warnf("File was changed and is not streamable: %s and %s (link=%s)", fileName, unrestrict.Filename, unrestrict.Link)
|
||||
|
||||
Reference in New Issue
Block a user