mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-07-13 00:02:53 +02:00
Update filesystem/pathexists endpoint to use existing isSameOrSubPath func
This commit is contained in:
@@ -117,7 +117,7 @@ class FileSystemController {
|
|||||||
filepath = fileUtils.filePathToPOSIX(filepath)
|
filepath = fileUtils.filePathToPOSIX(filepath)
|
||||||
|
|
||||||
// Ensure filepath is inside library folder (prevents directory traversal)
|
// Ensure filepath is inside library folder (prevents directory traversal)
|
||||||
if (!filepath.startsWith(libraryFolder.path)) {
|
if (!fileUtils.isSameOrSubPath(libraryFolder.path, filepath)) {
|
||||||
Logger.error(`[FileSystemController] Filepath is not inside library folder: ${filepath}`)
|
Logger.error(`[FileSystemController] Filepath is not inside library folder: ${filepath}`)
|
||||||
return res.sendStatus(400)
|
return res.sendStatus(400)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user