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