This commit is contained in:
syuilo 2019-03-02 11:34:34 +09:00
parent 3cfcb89c04
commit f87232178a
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69
3 changed files with 9 additions and 3 deletions

View file

@ -216,7 +216,7 @@ export const pack = (
const isImage = file.contentType && file.contentType.startsWith('image/');
_target.url = _file.metadata.webpublicUrl || _file.metadata.url;
_target.thumbnailUrl = _file.metadata.thumbnailUrl || _file.metadata.webpublicUrl || (isImage ? _file.metadata.url : '/assets/thumbnail-not-available.png');
_target.thumbnailUrl = _file.metadata.thumbnailUrl || _file.metadata.webpublicUrl || (isImage ? _file.metadata.url : '/files/thumbnail-not-available.png');
_target.isRemote = _file.metadata.isRemote;
if (_target.properties == null) _target.properties = {};

View file

@ -29,7 +29,13 @@ router.get('/default-avatar.jpg', ctx => {
router.get('/app-default.jpg', ctx => {
const file = fs.createReadStream(`${__dirname}/assets/dummy.png`);
ctx.set('Content-Type', 'image/jpeg');
ctx.set('Content-Type', 'image/png');
ctx.body = file;
});
router.get('/thumbnail-not-available.png', ctx => {
const file = fs.createReadStream(`${__dirname}/assets/thumbnail-not-available.png`);
ctx.set('Content-Type', 'image/png');
ctx.body = file;
});

View file

@ -67,7 +67,7 @@ export default async function(ctx: Koa.BaseContext) {
await sendRaw();
} else {
ctx.status = 404;
await send(ctx as any, '/dummy.png', { root: assets });
await send(ctx as any, '/thumbnail-not-available.png', { root: assets });
}
}
} else if (file.metadata.webpublicUrl === url) {