Skip to content

Commit

Permalink
fix: GEO-1259 - create read stream from a verified path string (#883)
Browse files Browse the repository at this point in the history
Co-authored-by: Sukanya Rath <[email protected]>
  • Loading branch information
banders and sukanya-rath authored Dec 12, 2024
1 parent 4d77b47 commit dcf0693
Showing 1 changed file with 5 additions and 5 deletions.
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

0 comments on commit dcf0693

Please sign in to comment.