281 unfurl show links #303
2 changed files with 10 additions and 8 deletions
|
@ -8,7 +8,7 @@ function determineFileExtensionFromContentType (contentType) {
|
||||||
switch (contentType) {
|
switch (contentType) {
|
||||||
case 'image/jpeg':
|
case 'image/jpeg':
|
||||||
case 'image/jpg':
|
case 'image/jpg':
|
||||||
return 'jpg';
|
return 'jpeg';
|
||||||
case 'image/png':
|
case 'image/png':
|
||||||
return 'png';
|
return 'png';
|
||||||
case 'image/gif':
|
case 'image/gif':
|
||||||
|
@ -16,8 +16,8 @@ function determineFileExtensionFromContentType (contentType) {
|
||||||
case 'video/mp4':
|
case 'video/mp4':
|
||||||
return 'mp4';
|
return 'mp4';
|
||||||
default:
|
default:
|
||||||
logger.debug('setting unknown file type as file extension jpg');
|
logger.debug('setting unknown file type as file extension jpeg');
|
||||||
return 'jpg';
|
return 'jpeg';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ function determineContentTypeFromFileExtension (fileExtension) {
|
||||||
switch (fileExtension) {
|
switch (fileExtension) {
|
||||||
case 'jpeg':
|
case 'jpeg':
|
||||||
case 'jpg':
|
case 'jpg':
|
||||||
return 'image/jpg';
|
return 'image/jpeg';
|
||||||
case 'png':
|
case 'png':
|
||||||
return 'image/png';
|
return 'image/png';
|
||||||
case 'gif':
|
case 'gif':
|
||||||
|
@ -33,8 +33,8 @@ function determineContentTypeFromFileExtension (fileExtension) {
|
||||||
case 'mp4':
|
case 'mp4':
|
||||||
return 'video/mp4';
|
return 'video/mp4';
|
||||||
default:
|
default:
|
||||||
logger.debug('setting unknown file type as type image/jpg');
|
logger.debug('setting unknown file type as type image/jpeg');
|
||||||
return 'image/jpg';
|
return 'image/jpeg';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -49,8 +49,10 @@ function clientAcceptsHtml ({accept}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function clientWantsAsset ({accept, range}) {
|
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 imageIsWanted = accept && accept.match(/image\/.*/) && !accept.match(/text\/html/) && !accept.match(/text\/\*/);
|
||||||
const videoIsWanted = accept && range;
|
const videoIsWanted = false; // accept && range;
|
||||||
|
logger.debug('image is wanted:', imageIsWanted);
|
||||||
|
logger.debug('video is wanted:', videoIsWanted);
|
||||||
return imageIsWanted || videoIsWanted;
|
return imageIsWanted || videoIsWanted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue