From 92cd020c58ed090ace8d31029830f18f0d1b019e Mon Sep 17 00:00:00 2001 From: Shawn Date: Mon, 3 Sep 2018 21:43:12 -0500 Subject: [PATCH] Fix content-type and file extensions (enforce image/jpeg and .jpg) --- client/src/utils/determineContentTypeFromExtension.js | 2 +- server/models/claim.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/src/utils/determineContentTypeFromExtension.js b/client/src/utils/determineContentTypeFromExtension.js index cd7f85b4..aa18f476 100644 --- a/client/src/utils/determineContentTypeFromExtension.js +++ b/client/src/utils/determineContentTypeFromExtension.js @@ -4,7 +4,7 @@ const determineContentTypeFromExtension = (thumbnail) => { switch (fileExt) { case 'jpeg': case 'jpg': - return 'image/jpg'; + return 'image/jpeg'; case 'png': return 'image/png'; case 'gif': diff --git a/server/models/claim.js b/server/models/claim.js index 3a841a58..6c1f4092 100644 --- a/server/models/claim.js +++ b/server/models/claim.js @@ -8,7 +8,7 @@ function determineFileExtensionFromContentType (contentType) { switch (contentType) { case 'image/jpeg': case 'image/jpg': - return 'jpeg'; + return 'jpg'; case 'image/png': return 'png'; case 'image/gif': @@ -16,8 +16,8 @@ function determineFileExtensionFromContentType (contentType) { case 'video/mp4': return 'mp4'; default: - logger.debug('setting unknown file type as file extension jpeg'); - return 'jpeg'; + logger.debug('setting unknown file type as file extension jpg'); + return 'jpg'; } }