Skip to content

Commit

Permalink
Remove fileService getFileStream fallback after completed migration (#…
Browse files Browse the repository at this point in the history
…6558)

To merge once the command has been executed.
  • Loading branch information
Weiko authored Aug 6, 2024
1 parent 4157a67 commit 48d0a36
Showing 1 changed file with 4 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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>) {
Expand Down

0 comments on commit 48d0a36

Please sign in to comment.