From 7d569e1e3e7196592763718fc6ef6a49ef8518d0 Mon Sep 17 00:00:00 2001 From: advplyr Date: Sat, 12 Nov 2022 09:36:00 -0600 Subject: [PATCH] Update:Some incorrect status codes returned from API --- server/controllers/LibraryItemController.js | 4 ++-- server/managers/CacheManager.js | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/server/controllers/LibraryItemController.js b/server/controllers/LibraryItemController.js index 56b181c2..f22a16d6 100644 --- a/server/controllers/LibraryItemController.js +++ b/server/controllers/LibraryItemController.js @@ -437,7 +437,7 @@ class LibraryItemController { async openRSSFeed(req, res) { if (!req.user.isAdminOrUp) { Logger.error(`[LibraryItemController] Non-admin user attempted to open RSS feed`, req.user.username) - return res.sendStatus(500) + return res.sendStatus(403) } const feedData = await this.rssFeedManager.openFeedForItem(req.user, req.libraryItem, req.body) @@ -457,7 +457,7 @@ class LibraryItemController { async closeRSSFeed(req, res) { if (!req.user.isAdminOrUp) { Logger.error(`[LibraryItemController] Non-admin user attempted to close RSS feed`, req.user.username) - return res.sendStatus(500) + return res.sendStatus(403) } await this.rssFeedManager.closeFeedForItem(req.params.id) diff --git a/server/managers/CacheManager.js b/server/managers/CacheManager.js index 78543ac9..3264f8f3 100644 --- a/server/managers/CacheManager.js +++ b/server/managers/CacheManager.js @@ -56,18 +56,18 @@ class CacheManager { stream.pipeline(r, ps, (err) => { if (err) { console.log(err) - return res.sendStatus(400) + return res.sendStatus(500) } }) return ps.pipe(res) } if (!libraryItem.media.coverPath || !await fs.pathExists(libraryItem.media.coverPath)) { - return res.sendStatus(404) + return res.sendStatus(500) } let writtenFile = await resizeImage(libraryItem.media.coverPath, path, width, height) - if (!writtenFile) return res.sendStatus(400) + if (!writtenFile) return res.sendStatus(500) // Set owner and permissions of cache image await filePerms.setDefault(path)