diff --git a/apps/backend/src/api/routes/media.controller.ts b/apps/backend/src/api/routes/media.controller.ts index 796ea6f53..9daccbef4 100644 --- a/apps/backend/src/api/routes/media.controller.ts +++ b/apps/backend/src/api/routes/media.controller.ts @@ -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') diff --git a/libraries/nestjs-libraries/src/upload/local.storage.ts b/libraries/nestjs-libraries/src/upload/local.storage.ts index 9d979889d..88b7722fb 100644 --- a/libraries/nestjs-libraries/src/upload/local.storage.ts +++ b/libraries/nestjs-libraries/src/upload/local.storage.ts @@ -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);