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

fix: GEO-1259 - create read stream from a verified path string #883

Merged
merged 2 commits into from
Dec 12, 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
10 changes: 5 additions & 5 deletions backend/src/v1/middlewares/storage/upload.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import fs from 'fs';
import { logger } from '../../../logger';
import {
PutObjectCommand,
PutObjectCommandInput,
S3Client,
} from '@aws-sdk/client-s3';
import os from 'os';
import retry from 'async-retry';
import { S3_BUCKET, S3_OPTIONS } from '../../../constants/admin';
import fs from 'fs';
import os from 'os';
import PATH from 'path';
import { v4 as uuidv4 } from 'uuid';
import { S3_BUCKET, S3_OPTIONS } from '../../../constants/admin';
import { logger } from '../../../logger';

interface Options {
folder: string;
Expand Down Expand Up @@ -41,7 +41,7 @@ export const useUpload = (options: Options) => {
res.end();
return;
}
const stream = fs.createReadStream(path);
const stream = fs.createReadStream(filePath);
const uploadParams: PutObjectCommandInput = {
Bucket: S3_BUCKET,
Key: `${options.folder}/${data.attachmentId}/${uuidv4()}.${ext}`,
Expand Down
Loading