yaml-admin-api 0.0.85 → 0.0.87
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/upload/s3Upload.js +6 -4
package/package.json
CHANGED
package/src/upload/s3Upload.js
CHANGED
|
@@ -60,10 +60,9 @@ const withConfigS3 = ({ access_key_id, secret_access_key, region, prefix, bucket
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
const uploadSecure = async (Key, stream) => {
|
|
63
|
-
console.log('uploadSecure', prefix, Key)
|
|
64
63
|
return await s3.send(new PutObjectCommand({
|
|
65
64
|
Bucket: bucket_private,
|
|
66
|
-
Key:
|
|
65
|
+
Key: (prefix ?`${prefix}/${Key}` : Key),
|
|
67
66
|
Body: stream,
|
|
68
67
|
ACL: 'private',
|
|
69
68
|
Expires: moment().add(10, 'minute').toDate(),
|
|
@@ -72,13 +71,16 @@ const withConfigS3 = ({ access_key_id, secret_access_key, region, prefix, bucket
|
|
|
72
71
|
}
|
|
73
72
|
|
|
74
73
|
const getUrl = async (Key) => {
|
|
75
|
-
|
|
74
|
+
if(prefix)
|
|
75
|
+
return `${base_url}/${prefix}/${Key}`
|
|
76
|
+
else
|
|
77
|
+
return `${base_url}/${Key}`
|
|
76
78
|
}
|
|
77
79
|
|
|
78
80
|
const getUrlSecure = async (Key) => {
|
|
79
81
|
const command = new GetObjectCommand({
|
|
80
82
|
Bucket: bucket_private,
|
|
81
|
-
Key: `${prefix}/${Key}
|
|
83
|
+
Key: prefix ? `${prefix}/${Key}` : Key,
|
|
82
84
|
})
|
|
83
85
|
const r = await getSignedUrl(s3, command, { expiresIn: 600 })
|
|
84
86
|
return r
|