From f87232178ab49d30c2a77e4a475777b9abb87079 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sat, 2 Mar 2019 11:34:34 +0900 Subject: [PATCH] Fix --- src/models/drive-file.ts | 2 +- src/server/file/index.ts | 8 +++++++- src/server/file/send-drive-file.ts | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/models/drive-file.ts b/src/models/drive-file.ts index 487717ef1..11037ac2a 100644 --- a/src/models/drive-file.ts +++ b/src/models/drive-file.ts @@ -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 = {}; diff --git a/src/server/file/index.ts b/src/server/file/index.ts index acb8322e3..5dbb5a4b5 100644 --- a/src/server/file/index.ts +++ b/src/server/file/index.ts @@ -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; }); diff --git a/src/server/file/send-drive-file.ts b/src/server/file/send-drive-file.ts index a9bc6f03e..7ccc52bae 100644 --- a/src/server/file/send-drive-file.ts +++ b/src/server/file/send-drive-file.ts @@ -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) {