From f7f2d1072b25f5dabd6ede4e613cbcdec1a8cd2c Mon Sep 17 00:00:00 2001 From: bill bittner Date: Wed, 13 Dec 2017 15:32:58 -0800 Subject: [PATCH] cards work on twitter for images, but not video) --- models/claim.js | 12 ++++++------ routes/serve-routes.js | 6 ++++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/models/claim.js b/models/claim.js index 5a6a6819..2fb62387 100644 --- a/models/claim.js +++ b/models/claim.js @@ -8,7 +8,7 @@ function determineFileExtensionFromContentType (contentType) { switch (contentType) { case 'image/jpeg': case 'image/jpg': - return 'jpg'; + return 'jpeg'; 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 jpg'); - return 'jpg'; + logger.debug('setting unknown file type as file extension jpeg'); + return 'jpeg'; } }; @@ -25,7 +25,7 @@ function determineContentTypeFromFileExtension (fileExtension) { switch (fileExtension) { case 'jpeg': case 'jpg': - return 'image/jpg'; + return 'image/jpeg'; case 'png': return 'image/png'; case 'gif': @@ -33,8 +33,8 @@ function determineContentTypeFromFileExtension (fileExtension) { case 'mp4': return 'video/mp4'; default: - logger.debug('setting unknown file type as type image/jpg'); - return 'image/jpg'; + logger.debug('setting unknown file type as type image/jpeg'); + return 'image/jpeg'; } }; diff --git a/routes/serve-routes.js b/routes/serve-routes.js index fea8b8ef..cbefd64c 100644 --- a/routes/serve-routes.js +++ b/routes/serve-routes.js @@ -49,8 +49,10 @@ function clientAcceptsHtml ({accept}) { } function clientWantsAsset ({accept, range}) { - const imageIsWanted = accept && accept.match(/image\/.*/) && !accept.match(/text\/html/) && !accept.match(/text\/\*/); // checks if an image is accepted, but not a video - const videoIsWanted = accept && range; + const imageIsWanted = accept && accept.match(/image\/.*/) && !accept.match(/text\/html/) && !accept.match(/text\/\*/); + const videoIsWanted = false; // accept && range; + logger.debug('image is wanted:', imageIsWanted); + logger.debug('video is wanted:', videoIsWanted); return imageIsWanted || videoIsWanted; }