281 unfurl show links #303

Merged
bones7242 merged 12 commits from 281-unfurl-show-links into master 2017-12-15 17:01:23 +01:00
2 changed files with 10 additions and 8 deletions
Showing only changes of commit f7f2d1072b - Show all commits

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