Skip to content

Commit 46ef91b

Browse files
authored
Merge pull request #339 from gitroomhq/feat/file-path
fix file path
2 parents 2a16bce + 5a7be6e commit 46ef91b

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

apps/backend/src/api/routes/media.controller.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,8 @@ export class MediaController {
4343
@GetOrgFromRequest() org: Organization,
4444
@UploadedFile() file: Express.Multer.File
4545
) {
46-
const uploadedFile = await this.storage.uploadFile(file);
47-
const filePath = uploadedFile.path.replace(process.env.UPLOAD_DIRECTORY, basename(process.env.UPLOAD_DIRECTORY));
48-
return this._mediaService.saveFile(org.id, uploadedFile.originalname, filePath);
46+
const uploadedFile = await this.storage.uploadFile(file);
47+
return this._mediaService.saveFile(org.id, uploadedFile.originalname, uploadedFile.path);
4948
}
5049

5150
@Post('/upload-simple')

libraries/nestjs-libraries/src/upload/local.storage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export class LocalStorage implements IUploadProvider {
5454
const publicPath = `${innerPath}/${randomName}${extname(
5555
file.originalname
5656
)}`;
57-
console.log(filePath);
57+
5858
// Logic to save the file to the filesystem goes here
5959
writeFileSync(filePath, file.buffer);
6060

0 commit comments

Comments
 (0)