From 8f1b060de4a634055e0c4b44804befbabfce5a5a Mon Sep 17 00:00:00 2001 From: Anbarasu Date: Sat, 27 Jul 2024 19:35:53 +0530 Subject: [PATCH] fix: thumbnail generation failing in Other S3 providers (#9088) * fix: thumbnail generation failing in Other S3 providers * fix: handle relative path generation for thumbnails * fix: regex --- .../thumbnail-generator/thumbnail-generator.processor.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/thumbnail-generator.processor.ts b/packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/thumbnail-generator.processor.ts index 8513c7454a..08220e4c81 100644 --- a/packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/thumbnail-generator.processor.ts +++ b/packages/nocodb/src/modules/jobs/jobs/thumbnail-generator/thumbnail-generator.processor.ts @@ -133,7 +133,7 @@ export class ThumbnailGeneratorProcessor { relativePath = decodeURI(new URL(attachment.url).pathname); signedUrl = await PresignedUrl.getSignedUrl({ - pathOrUrl: relativePath, + pathOrUrl: attachment.url, preview: false, filename: attachment.title, mimetype: attachment.mimetype, @@ -143,9 +143,7 @@ export class ThumbnailGeneratorProcessor { .data as Buffer; } - if (relativePath.startsWith('/nc/uploads/')) { - relativePath = relativePath.replace('/nc/uploads/', ''); - } + relativePath = relativePath.replace(/^.*?(?=\/noco)/, ''); return { file, relativePath }; }