Skip to content

The open alternative to Salesforce, designed for AI.

Remove fileService getFileStream fallback after completed migration (#6558)

Weiko48d0a3649dda
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 7b71fc59bc8..0bfef082bd1 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<Stream> {
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<string, any>) {