mirror of
https://github.com/twentyhq/twenty.git
synced 2024-12-24 12:34:10 +03:00
Remove fileService getFileStream fallback after completed migration (#6558)
To merge once the command has been executed.
This commit is contained in:
parent
4157a67bf8
commit
48d0a3649d
@ -5,11 +5,6 @@ import { Stream } from 'stream';
|
|||||||
import { addMilliseconds } from 'date-fns';
|
import { addMilliseconds } from 'date-fns';
|
||||||
import ms from 'ms';
|
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 { JwtWrapperService } from 'src/engine/core-modules/jwt/services/jwt-wrapper.service';
|
||||||
import { EnvironmentService } from 'src/engine/integrations/environment/environment.service';
|
import { EnvironmentService } from 'src/engine/integrations/environment/environment.service';
|
||||||
import { FileStorageService } from 'src/engine/integrations/file-storage/file-storage.service';
|
import { FileStorageService } from 'src/engine/integrations/file-storage/file-storage.service';
|
||||||
@ -29,24 +24,10 @@ export class FileService {
|
|||||||
): Promise<Stream> {
|
): Promise<Stream> {
|
||||||
const workspaceFolderPath = `workspace-${workspaceId}/${folderPath}`;
|
const workspaceFolderPath = `workspace-${workspaceId}/${folderPath}`;
|
||||||
|
|
||||||
try {
|
return await this.fileStorageService.read({
|
||||||
return await this.fileStorageService.read({
|
folderPath: workspaceFolderPath,
|
||||||
folderPath: workspaceFolderPath,
|
filename,
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async encodeFileToken(payloadToEncode: Record<string, any>) {
|
async encodeFileToken(payloadToEncode: Record<string, any>) {
|
||||||
|
Loading…
Reference in New Issue
Block a user