Skip to content

Commit

Permalink
create read stream from a verified path string
Browse files Browse the repository at this point in the history
  • Loading branch information
banders committed Dec 12, 2024
1 parent ab39e1c commit d09bb4b
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 d09bb4b

Please sign in to comment.