fix(medusa-file-spaces): Allow duplicate filenames (#1474)
This commit is contained in:
committed by
GitHub
parent
f71b9b3a87
commit
525910f72a
@@ -1,5 +1,6 @@
|
||||
import fs from "fs"
|
||||
import aws from "aws-sdk"
|
||||
import { parse } from "path"
|
||||
import { FileService } from "medusa-interfaces"
|
||||
|
||||
class DigitalOceanService extends FileService {
|
||||
@@ -23,12 +24,14 @@ class DigitalOceanService extends FileService {
|
||||
endpoint: this.endpoint_,
|
||||
})
|
||||
|
||||
const parsedFilename = parse(file.originalname)
|
||||
const fileKey = `${parsedFilename.name}-${Date.now()}${parsedFilename.ext}`
|
||||
const s3 = new aws.S3()
|
||||
var params = {
|
||||
ACL: "public-read",
|
||||
Bucket: this.bucket_,
|
||||
Body: fs.createReadStream(file.path),
|
||||
Key: `${file.originalname}`,
|
||||
Key: fileKey,
|
||||
}
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
Reference in New Issue
Block a user