mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-06-24 17:59:06 +02:00
Fix:Updating library folder paths will only set file permissions if it needed to create the folder #529
This commit is contained in:
parent
2a235b8324
commit
b925dbcc95
1 changed files with 11 additions and 7 deletions
|
@ -86,13 +86,17 @@ class LibraryController {
|
||||||
return f
|
return f
|
||||||
})
|
})
|
||||||
for (var path of newFolderPaths) {
|
for (var path of newFolderPaths) {
|
||||||
|
var pathExists = await fs.pathExists(path)
|
||||||
|
if (!pathExists) {
|
||||||
|
// Ensure dir will recursively create directories which might be preferred over mkdir
|
||||||
var success = await fs.ensureDir(path).then(() => true).catch((error) => {
|
var success = await fs.ensureDir(path).then(() => true).catch((error) => {
|
||||||
Logger.error(`[LibraryController] Failed to ensure folder dir "${path}"`, error)
|
Logger.error(`[LibraryController] Failed to ensure folder dir "${path}"`, error)
|
||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
if (!success) {
|
if (!success) {
|
||||||
return res.status(400).send(`Invalid folder directory "${path}"`)
|
return res.status(400).send(`Invalid folder directory "${path}"`)
|
||||||
} else {
|
}
|
||||||
|
// Set permissions on newly created path
|
||||||
await filePerms.setDefault(path)
|
await filePerms.setDefault(path)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue