From a2aa4d58bc2fc2458c40cda2b1a2352228078631 Mon Sep 17 00:00:00 2001 From: Josh Moore Date: Mon, 7 Feb 2022 18:27:35 -0700 Subject: [PATCH] Added shitty patch for `webp` failing to upload (#111) --- src/thumbnails.ts | 2 +- src/vibrant.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/thumbnails.ts b/src/thumbnails.ts index 33b8748..752258b 100644 --- a/src/thumbnails.ts +++ b/src/thumbnails.ts @@ -84,6 +84,6 @@ function getImageThumbnail(file: FileData) { */ export default (file: FileData): Promise => new Promise((resolve, reject) => - (file.is.video ? getVideoThumbnail : file.is.image ? getImageThumbnail : () => Promise.resolve())(file) + (file.is.video ? getVideoThumbnail : (file.is.image && !file.mimetype.includes('webp')) ? getImageThumbnail : () => Promise.resolve())(file) .then(() => resolve((file.is.video || file.is.image) ? getNewName(file.randomId) : file.is.audio ? 'views/ass-audio-icon.png' : 'views/ass-file-icon.png')) .catch(reject)); diff --git a/src/vibrant.ts b/src/vibrant.ts index dd02b77..b81510c 100644 --- a/src/vibrant.ts +++ b/src/vibrant.ts @@ -26,4 +26,4 @@ function getVibrant(file: FileData, resolve: Function, reject: Function) { * @param {*} file The file to get a colour from * @returns The Vibrant colour as a Hex value (or random Hex value for videos) */ -export default (file: FileData): Promise => new Promise((resolve, reject) => !file.is.image ? resolve(randomHexColour()) : getVibrant(file, resolve, reject)); // skipcq: JS-0229 +export default (file: FileData): Promise => new Promise((resolve, reject) => (!file.is.image || file.mimetype.includes('webp')) ? resolve(randomHexColour()) : getVibrant(file, resolve, reject)); // skipcq: JS-0229