feat: add file path

This commit is contained in:
Nevo David 2024-03-14 15:54:46 +07:00
parent e8475929a8
commit 4c60b7794b
2 changed files with 5 additions and 2 deletions

View File

@ -35,7 +35,10 @@ export class MediaController {
)
file: Express.Multer.File
) {
const filePath = file.path.replace(process.env.UPLOAD_DIRECTORY, '');
const filePath =
file.path.indexOf('http') === 0
? file.path
: file.path.replace(process.env.UPLOAD_DIRECTORY, '');
return this._mediaService.saveFile(org.id, file.originalname, filePath);
}

View File

@ -9,8 +9,8 @@ const storage =
process.env.CLOUDFLARE_ACCOUNT_ID &&
process.env.CLOUDFLARE_ACCESS_KEY &&
process.env.CLOUDFLARE_SECRET_ACCESS_KEY &&
process.env.CLOUDFLARE_BUCKETNAME &&
process.env.CLOUDFLARE_REGION &&
process.env.CLOUDFLARE_BUCKETNAME &&
process.env.CLOUDFLARE_BUCKET_URL
? new CloudflareStorage(
process.env.CLOUDFLARE_ACCOUNT_ID,