parse {file, thumbnail} with parsePublishApiRequestFiles

This commit is contained in:
Travis Eden 2018-10-22 09:52:17 -04:00
parent 97de13527a
commit 30eae51069

View file

@ -6,7 +6,7 @@ const { sendGATimingEvent } = require('../../../../utils/googleAnalytics.js');
const { handleErrorResponse } = require('../../../utils/errorHandlers.js'); const { handleErrorResponse } = require('../../../utils/errorHandlers.js');
const publish = require('../publish/publish.js'); const publish = require('../publish/publish.js');
const parsePublishApiRequestBody = require('../publish/parsePublishApiRequestBody'); const parsePublishApiRequestBody = require('../publish/parsePublishApiRequestBody');
const {parsePublishApiRequestFiles, parsePublishApiRequestThumbnail} = require('../publish/parsePublishApiRequestFiles.js'); const parsePublishApiRequestFiles = require('../publish/parsePublishApiRequestFiles.js');
const authenticateUser = require('../publish/authentication.js'); const authenticateUser = require('../publish/authentication.js');
const createThumbnailPublishParams = require('../publish/createThumbnailPublishParams.js'); const createThumbnailPublishParams = require('../publish/createThumbnailPublishParams.js');
@ -66,12 +66,7 @@ const claimUpdate = ({ body, files, headers, ip, originalUrl, user, tor }, res)
try { try {
({name, nsfw, license, title, description, thumbnail} = parsePublishApiRequestBody(body)); ({name, nsfw, license, title, description, thumbnail} = parsePublishApiRequestBody(body));
if (files.file) { ({fileName, filePath, fileExtension, fileType, thumbnailFileName, thumbnailFilePath, thumbnailFileType} = parsePublishApiRequestFiles(files));
({fileName, filePath, fileExtension, fileType} = parsePublishApiRequestFiles(files));
if (files.thumbnail) {
({thumbnailFileName, thumbnailFilePath, thumbnailFileType} = parsePublishApiRequestThumbnail(files));
}
}
({channelName, channelId, channelPassword} = body); ({channelName, channelId, channelPassword} = body);
} catch (error) { } catch (error) {
return res.status(400).json({success: false, message: error.message}); return res.status(400).json({success: false, message: error.message});