serve static assets on urls with file extension #538

Merged
bones7242 merged 19 commits from 515-showlite-serves-asset into master 2018-07-20 18:57:12 +02:00
2 changed files with 4 additions and 4 deletions
Showing only changes of commit 195d22bece - Show all commits

View file

@ -1,7 +1,7 @@
const EMBED = 'EMBED'; const SERVE = 'SERVE';
const SHOW = 'SHOW'; const SHOW = 'SHOW';
module.exports = { module.exports = {
EMBED, SERVE,
SHOW, SHOW,
}; };

View file

@ -1,4 +1,4 @@
const { EMBED, SHOW } = require('../constants/request_types.js'); const { SERVE, SHOW } = require('../constants/request_types.js');
function clientWantsAsset ({accept, range}) { function clientWantsAsset ({accept, range}) {
const imageIsWanted = accept && accept.match(/image\/.*/) && !accept.match(/text\/html/); const imageIsWanted = accept && accept.match(/image\/.*/) && !accept.match(/text\/html/);
@ -8,7 +8,7 @@ function clientWantsAsset ({accept, range}) {
const determineRequestType = (hasFileExtension, headers) => { const determineRequestType = (hasFileExtension, headers) => {
if (hasFileExtension || clientWantsAsset(headers)) { if (hasFileExtension || clientWantsAsset(headers)) {
return EMBED; return SERVE;
} }
return SHOW; return SHOW;
}; };