Add retain_folder_name_extension option
This commit is contained in:
@@ -11,7 +11,6 @@ import (
|
||||
"github.com/debridmediamanager.com/zurg/internal/dav"
|
||||
intHttp "github.com/debridmediamanager.com/zurg/internal/http"
|
||||
"github.com/debridmediamanager.com/zurg/internal/torrent"
|
||||
"github.com/debridmediamanager.com/zurg/pkg/davextra"
|
||||
"github.com/debridmediamanager.com/zurg/pkg/logutil"
|
||||
"github.com/debridmediamanager.com/zurg/pkg/realdebrid"
|
||||
"github.com/hashicorp/golang-lru/v2/expirable"
|
||||
@@ -58,8 +57,7 @@ func HandleGetRequest(w http.ResponseWriter, r *http.Request, t *torrent.Torrent
|
||||
return
|
||||
}
|
||||
|
||||
filenameV2, linkFragment := davextra.ExtractLinkFragment(filename)
|
||||
torrent, file := getFile(torrents, filenameV2, linkFragment)
|
||||
torrent, file := getFile(torrents, filename)
|
||||
if file == nil {
|
||||
log.Errorf("Cannot find file from path %s", requestPath)
|
||||
http.Error(w, "File not found", http.StatusNotFound)
|
||||
@@ -79,20 +77,20 @@ func HandleGetRequest(w http.ResponseWriter, r *http.Request, t *torrent.Torrent
|
||||
resp := realdebrid.RetryUntilOk(unrestrictFn)
|
||||
if resp == nil {
|
||||
if !file.Unavailable {
|
||||
log.Errorf("Cannot unrestrict file %s %s", filenameV2, link)
|
||||
log.Errorf("Cannot unrestrict file %s %s", filename, link)
|
||||
t.HideTheFile(torrent, file)
|
||||
}
|
||||
streamErrorVideo("https://www.youtube.com/watch?v=gea_FJrtFVA", w, r, c, log)
|
||||
return
|
||||
} else if resp.Filename != filenameV2 {
|
||||
} else if resp.Filename != filename {
|
||||
actualExt := filepath.Ext(resp.Filename)
|
||||
expectedExt := filepath.Ext(filenameV2)
|
||||
expectedExt := filepath.Ext(filename)
|
||||
if actualExt != expectedExt && resp.Streamable != 1 {
|
||||
log.Errorf("File extension mismatch: %s and %s", filenameV2, resp.Filename)
|
||||
log.Errorf("File extension mismatch: %s and %s", filename, resp.Filename)
|
||||
streamErrorVideo("https://www.youtube.com/watch?v=t9VgOriBHwE", w, r, c, log)
|
||||
return
|
||||
} else {
|
||||
log.Errorf("Filename mismatch: %s and %s", filenameV2, resp.Filename)
|
||||
log.Errorf("Filename mismatch: %s and %s", filename, resp.Filename)
|
||||
}
|
||||
}
|
||||
cache.Add(requestPath, resp.Download)
|
||||
|
||||
Reference in New Issue
Block a user