mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-03-14 15:18:22 +01:00
Fix file names with URL control characters
This patch ensures that files names like `series #3 xy.jpg` are actually handled correctly instead of the part after `#` being interpreted as fragment and being discarded. I noticed that in a few rare cases the App wouldn't properly display cover images. It turns out that due the file names containing a `#`, the file path got corrupted, causing Audiobookshelf to return a 403.
This commit is contained in:
parent
d2b006b909
commit
987842ed04
@ -357,7 +357,10 @@ module.exports.removeFile = (path) => {
|
||||
}
|
||||
|
||||
module.exports.encodeUriPath = (path) => {
|
||||
const uri = new URL(path, "file://")
|
||||
const uri = new URL('/', "file://")
|
||||
// we assign the path here to assure that URL control characters like # are
|
||||
// actually interpreted as part of the URL path
|
||||
uri.pathname = path
|
||||
return uri.pathname
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user