diff --git a/client/components/modals/libraries/EditModal.vue b/client/components/modals/libraries/EditModal.vue index 62ccc1a1..4e348d7f 100644 --- a/client/components/modals/libraries/EditModal.vue +++ b/client/components/modals/libraries/EditModal.vue @@ -142,7 +142,7 @@ export default { var updatePayload = {} for (const key in this.libraryCopy) { if (key === 'folders') { - if (this.libraryCopy.folders.join(',') !== this.library.folders.join(',')) { + if (this.libraryCopy.folders.map((f) => f.fullPath).join(',') !== this.library.folders.map((f) => f.fullPath).join(',')) { updatePayload.folders = [...this.libraryCopy.folders] } } else if (key === 'settings') { diff --git a/server/controllers/LibraryController.js b/server/controllers/LibraryController.js index d55751b5..dba55dba 100644 --- a/server/controllers/LibraryController.js +++ b/server/controllers/LibraryController.js @@ -26,14 +26,15 @@ class LibraryController { return f }) for (var folder of newLibraryPayload.folders) { - var success = await fs.ensureDir(folder.fullPath).then(() => true).catch((error) => { + try { + var direxists = await fs.pathExists(folder.fullPath) + if (!direxists) { // If folder does not exist try to make it and set file permissions/owner + await fs.mkdir(folder.fullPath) + await filePerms.setDefault(folder.fullPath) + } + } catch (error) { Logger.error(`[LibraryController] Failed to ensure folder dir "${folder.fullPath}"`, error) - return false - }) - if (!success) { return res.status(400).send(`Invalid folder directory "${folder.fullPath}"`) - } else { - await filePerms.setDefault(folder.fullPath) } }