mirror of
https://github.com/strapi/strapi.git
synced 2025-11-29 16:41:19 +00:00
update for undefined path
This commit is contained in:
parent
36175b0237
commit
5e66ee59d0
@ -70,8 +70,9 @@ module.exports = {
|
||||
upload: (file) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
// upload file on S3 bucket
|
||||
const path = file.path ? `${file.path}/` : '';
|
||||
S3.upload({
|
||||
Key: `${file.path}/${file.hash}${file.ext}`,
|
||||
Key: `${path}${file.hash}${file.ext}`,
|
||||
Body: new Buffer(file.buffer, 'binary'),
|
||||
ACL: 'public-read',
|
||||
ContentType: file.mime,
|
||||
@ -90,10 +91,11 @@ module.exports = {
|
||||
delete: (file) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
// delete file on S3 bucket
|
||||
const path = file.path ? `${file.path}/` : '';
|
||||
S3.deleteObjects({
|
||||
Delete: {
|
||||
Objects: [{
|
||||
Key: `${file.path}/${file.hash}${file.ext}`
|
||||
Key: `${path}${file.hash}${file.ext}`
|
||||
}]
|
||||
}
|
||||
}, (err, data) => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user