Merge pull request #339 from gitroomhq/feat/file-path
Some checks failed
Build Containers / build-containers-common (push) Has been cancelled
Build Containers / build-containers (amd64, ubuntu-latest) (push) Has been cancelled
Build Containers / build-containers (arm64, [self-hosted ARM64]) (push) Has been cancelled
Build Containers / build-container-manifest (push) Has been cancelled

fix file path
This commit is contained in:
Nevo David 2024-10-07 22:20:20 +07:00 committed by GitHub
commit 46ef91b9d8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 4 deletions

View file

@ -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')

View file

@ -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);