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 89d64da9e6..034e39aad4 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 @@ -137,8 +137,17 @@ export class ThumbnailGeneratorProcessor { const file = await storageAdapter.fileRead(relativePath); - // remove everything before 'nc/uploads/' (including nc/uploads/) in relativePath - relativePath = relativePath.replace(/^.*?nc[/\\]uploads[/\\]/, ''); + const scopePath = scope ? scope : 'uploads'; + + // remove everything before 'nc/${scopePath}/' (including nc/${scopePath}/) in relativePath + relativePath = relativePath.replace( + new RegExp(`^.*?nc[/\\\\]${scopePath}[/\\\\]`), + '', + ); + + if (scope) { + relativePath = `${scopePath}/${relativePath}`; + } return { file, relativePath }; }