cards work on twitter for images, but not video)

This commit is contained in:
bill bittner 2017-12-13 15:32:58 -08:00
parent 7fd4a6cb8f
commit f7f2d1072b
2 changed files with 10 additions and 8 deletions

View file

@ -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';
}
};

View file

@ -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;
}