Fix
This commit is contained in:
parent
3cfcb89c04
commit
f87232178a
3 changed files with 9 additions and 3 deletions
|
@ -216,7 +216,7 @@ export const pack = (
|
||||||
const isImage = file.contentType && file.contentType.startsWith('image/');
|
const isImage = file.contentType && file.contentType.startsWith('image/');
|
||||||
|
|
||||||
_target.url = _file.metadata.webpublicUrl || _file.metadata.url;
|
_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;
|
_target.isRemote = _file.metadata.isRemote;
|
||||||
|
|
||||||
if (_target.properties == null) _target.properties = {};
|
if (_target.properties == null) _target.properties = {};
|
||||||
|
|
|
@ -29,7 +29,13 @@ router.get('/default-avatar.jpg', ctx => {
|
||||||
|
|
||||||
router.get('/app-default.jpg', ctx => {
|
router.get('/app-default.jpg', ctx => {
|
||||||
const file = fs.createReadStream(`${__dirname}/assets/dummy.png`);
|
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;
|
ctx.body = file;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ export default async function(ctx: Koa.BaseContext) {
|
||||||
await sendRaw();
|
await sendRaw();
|
||||||
} else {
|
} else {
|
||||||
ctx.status = 404;
|
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) {
|
} else if (file.metadata.webpublicUrl === url) {
|
||||||
|
|
Loading…
Reference in a new issue