Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove fileService getFileStream fallback after completed migration #6558

Merged
merged 1 commit into from
Aug 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading