Changeset View
Changeset View
Standalone View
Standalone View
keyserver/src/uploads/uploads.js
Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | ): Promise<MultimediaUploadResult> { | ||||
} | } | ||||
const inputDimensions: ?Dimensions = | const inputDimensions: ?Dimensions = | ||||
inputHeight && inputWidth | inputHeight && inputWidth | ||||
? { height: inputHeight, width: inputWidth } | ? { height: inputHeight, width: inputWidth } | ||||
: null; | : null; | ||||
const inputLoop = !!(files.length === 1 && body.loop); | const inputLoop = !!(files.length === 1 && body.loop); | ||||
const inputEncryptionKey = | |||||
files.length === 1 && body.encryptionKey ? body.encryptionKey : null; | |||||
if (inputEncryptionKey && typeof inputEncryptionKey !== 'string') { | |||||
throw new ServerError('invalid_parameters'); | |||||
} | |||||
const inputMimeType = | |||||
files.length === 1 && body.mimeType ? body.mimeType : null; | |||||
if (inputMimeType && typeof inputMimeType !== 'string') { | |||||
throw new ServerError('invalid_parameters'); | |||||
} | |||||
const validationResults = await Promise.all( | const validationResults = await Promise.all( | ||||
files.map(({ buffer, size, originalname }) => | files.map(({ buffer, size, originalname }) => | ||||
validateAndConvert( | validateAndConvert( | ||||
buffer, | buffer, | ||||
overrideFilename ? overrideFilename : originalname, | overrideFilename ? overrideFilename : originalname, | ||||
inputDimensions, | inputDimensions, | ||||
inputLoop, | inputLoop, | ||||
size, | size, | ||||
▲ Show 20 Lines • Show All 91 Lines • Show Last 20 Lines |