From 48d0a3649dda40a2b0d0d6f80267208b037f705d Mon Sep 17 00:00:00 2001 From: Weiko Date: Tue, 6 Aug 2024 18:19:50 +0200 Subject: [PATCH] Remove fileService getFileStream fallback after completed migration (#6558) To merge once the command has been executed. --- .../file/services/file.service.ts | 27 +++---------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/packages/twenty-server/src/engine/core-modules/file/services/file.service.ts b/packages/twenty-server/src/engine/core-modules/file/services/file.service.ts index 7b71fc59bc8e..0bfef082bd11 100644 --- a/packages/twenty-server/src/engine/core-modules/file/services/file.service.ts +++ b/packages/twenty-server/src/engine/core-modules/file/services/file.service.ts @@ -5,11 +5,6 @@ import { Stream } from 'stream'; import { addMilliseconds } from 'date-fns'; import ms from 'ms'; -import { - FileStorageException, - FileStorageExceptionCode, -} from 'src/engine/integrations/file-storage/interfaces/file-storage-exception'; - import { JwtWrapperService } from 'src/engine/core-modules/jwt/services/jwt-wrapper.service'; import { EnvironmentService } from 'src/engine/integrations/environment/environment.service'; import { FileStorageService } from 'src/engine/integrations/file-storage/file-storage.service'; @@ -29,24 +24,10 @@ export class FileService { ): Promise { const workspaceFolderPath = `workspace-${workspaceId}/${folderPath}`; - try { - return await this.fileStorageService.read({ - folderPath: workspaceFolderPath, - filename, - }); - } catch (error) { - // TODO: Remove this fallback when all files are moved to workspace folders - if ( - error instanceof FileStorageException && - error.code === FileStorageExceptionCode.FILE_NOT_FOUND - ) { - return await this.fileStorageService.read({ - folderPath, - filename, - }); - } - throw error; - } + return await this.fileStorageService.read({ + folderPath: workspaceFolderPath, + filename, + }); } async encodeFileToken(payloadToEncode: Record) {