diff --git a/server/controllers/api/claim/publish/parsePublishApiRequestFiles.js b/server/controllers/api/claim/publish/parsePublishApiRequestFiles.js index d5b447b8..6e1f3409 100644 --- a/server/controllers/api/claim/publish/parsePublishApiRequestFiles.js +++ b/server/controllers/api/claim/publish/parsePublishApiRequestFiles.js @@ -3,7 +3,17 @@ const validateFileTypeAndSize = require('./validateFileTypeAndSize.js'); const parsePublishApiRequestFiles = ({file, thumbnail}, isUpdate) => { // make sure a file was provided - if (!file && !isUpdate) { + if (!file) { + if (isUpdate) { + if (thumbnail) { + const obj = {}; + obj.thumbnailFileName = thumbnail.name; + obj.thumbnailFilePath = thumbnail.path; + obj.thumbnailFileType = thumbnail.type; + return obj; + } + return {}; + } throw new Error('no file with key of [file] found in request'); } if (!file.path) { diff --git a/server/controllers/api/claim/update/index.js b/server/controllers/api/claim/update/index.js index ab2e2f25..bd3a262d 100644 --- a/server/controllers/api/claim/update/index.js +++ b/server/controllers/api/claim/update/index.js @@ -66,7 +66,7 @@ const claimUpdate = ({ body, files, headers, ip, originalUrl, user, tor }, res) try { ({name, nsfw, license, title, description, thumbnail} = parsePublishApiRequestBody(body)); - ({fileName, filePath, fileExtension, fileType, thumbnailFileName, thumbnailFilePath, thumbnailFileType} = parsePublishApiRequestFiles(files)); + ({fileName, filePath, fileExtension, fileType, thumbnailFileName, thumbnailFilePath, thumbnailFileType} = parsePublishApiRequestFiles(files, true)); ({channelName, channelId, channelPassword} = body); } catch (error) { return res.status(400).json({success: false, message: error.message});