Skip to content

Commit

Permalink
feat: fixed file path
Browse files Browse the repository at this point in the history
  • Loading branch information
Nevo David committed Oct 7, 2024
1 parent 2a16bce commit 5a7be6e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions apps/backend/src/api/routes/media.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,8 @@ export class MediaController {
@GetOrgFromRequest() org: Organization,
@UploadedFile() file: Express.Multer.File
) {
const uploadedFile = await this.storage.uploadFile(file);
const filePath = uploadedFile.path.replace(process.env.UPLOAD_DIRECTORY, basename(process.env.UPLOAD_DIRECTORY));
return this._mediaService.saveFile(org.id, uploadedFile.originalname, filePath);
const uploadedFile = await this.storage.uploadFile(file);
return this._mediaService.saveFile(org.id, uploadedFile.originalname, uploadedFile.path);
}

@Post('/upload-simple')
Expand Down
2 changes: 1 addition & 1 deletion libraries/nestjs-libraries/src/upload/local.storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class LocalStorage implements IUploadProvider {
const publicPath = `${innerPath}/${randomName}${extname(
file.originalname
)}`;
console.log(filePath);

// Logic to save the file to the filesystem goes here
writeFileSync(filePath, file.buffer);

Expand Down

0 comments on commit 5a7be6e

Please sign in to comment.