From f3321c3d9e569031a37ba123710d46d2ed0b91f8 Mon Sep 17 00:00:00 2001 From: MeiMei <30769358+mei23@users.noreply.github.com> Date: Tue, 9 Apr 2019 21:07:46 +0900 Subject: [PATCH] Fix non media thumbnails (#4380) --- src/client/assets/thumbnail-not-available.png | 3 +++ src/misc/get-drive-file-url.ts | 2 +- src/server/file/send-drive-file.ts | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 src/client/assets/thumbnail-not-available.png diff --git a/src/client/assets/thumbnail-not-available.png b/src/client/assets/thumbnail-not-available.png new file mode 100644 index 000000000..ba489c62e --- /dev/null +++ b/src/client/assets/thumbnail-not-available.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:65f5b8de0f28a495ef8acb35ec067275ce5f641694617ecc9a72bd0bdbc983f8 +size 5705 diff --git a/src/misc/get-drive-file-url.ts b/src/misc/get-drive-file-url.ts index 067db8a5d..f2b0f8b00 100644 --- a/src/misc/get-drive-file-url.ts +++ b/src/misc/get-drive-file-url.ts @@ -8,7 +8,7 @@ export default function(file: IDriveFile, thumbnail = false): string { if (file.metadata.withoutChunks) { if (thumbnail) { - return file.metadata.thumbnailUrl || file.metadata.webpublicUrl || (isImage ? file.metadata.url : null); + return file.metadata.thumbnailUrl || file.metadata.webpublicUrl || (isImage ? file.metadata.url : '/assets/thumbnail-not-available.png'); } else { return file.metadata.webpublicUrl || file.metadata.url; } diff --git a/src/server/file/send-drive-file.ts b/src/server/file/send-drive-file.ts index e0208f3fa..b22124240 100644 --- a/src/server/file/send-drive-file.ts +++ b/src/server/file/send-drive-file.ts @@ -73,7 +73,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 ('web' in ctx.query) {