From a9d19eb3df4f49e0eee328111cdd081a6cf102f6 Mon Sep 17 00:00:00 2001 From: Leonardo Viva Date: Thu, 18 Jul 2024 17:13:09 -0300 Subject: [PATCH] fix: image thumbnail path --- src/server/routes/rest/file/image.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/server/routes/rest/file/image.ts b/src/server/routes/rest/file/image.ts index 8666a94..4d8d8bc 100644 --- a/src/server/routes/rest/file/image.ts +++ b/src/server/routes/rest/file/image.ts @@ -69,7 +69,8 @@ async function imageApiFn( const getImagePath = () => { const maxDimension = Math.max(parseInt(width, 10), parseInt(height, 10)); if (maxDimension <= thumbnailSize) { - return path.join(document, recordId, fieldName, 'thumbnail', fileName).replace(/\.jpeg$/, '') + '.jpeg'; + const filePath = path.join(document, recordId, fieldName, 'thumbnail', fileName); + return /\.jpe?g$/.test(fileName) ? filePath : `${filePath}.jpeg`; } if (preprocess != null) { return path.join(document, recordId, fieldName, 'watermark', fileName);