Skip to content

Commit

Permalink
Fix updating cover from match requests #3807
Browse files Browse the repository at this point in the history
  • Loading branch information
advplyr committed Jan 7, 2025
1 parent ed59608 commit 8286aad
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions server/controllers/LibraryItemController.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ class LibraryItemController {
*
* @param {LibraryItemControllerRequest} req
* @param {Response} res
* @param {boolean} [updateAndReturnJson=true]
* @param {boolean} [updateAndReturnJson=true] - Allows the function to be used for both direct API calls and internally
*/
async uploadCover(req, res, updateAndReturnJson = true) {
if (!req.user.canUpload) {
Expand All @@ -291,11 +291,11 @@ class LibraryItemController {
return res.status(500).send('Unknown error occurred')
}

if (updateAndReturnJson) {
req.libraryItem.media.coverPath = result.cover
req.libraryItem.media.changed('coverPath', true)
await req.libraryItem.media.save()
req.libraryItem.media.coverPath = result.cover
req.libraryItem.media.changed('coverPath', true)
await req.libraryItem.media.save()

if (updateAndReturnJson) {
// client uses updatedAt timestamp in URL to force refresh cover
req.libraryItem.changed('updatedAt', true)
await req.libraryItem.save()
Expand Down

0 comments on commit 8286aad

Please sign in to comment.