Skip to content

Commit

Permalink
Merge pull request #339 from gitroomhq/feat/file-path
Browse files Browse the repository at this point in the history
fix file path
  • Loading branch information
nevo-david authored Oct 7, 2024
2 parents 2a16bce + 5a7be6e commit 46ef91b
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 46ef91b

Please sign in to comment.