@strapi/provider-upload-aws-s3 4.4.5 → 4.4.7
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/lib/index.js +11 -1
- package/package.json +2 -2
package/lib/index.js
CHANGED
|
@@ -9,6 +9,11 @@
|
|
|
9
9
|
const _ = require('lodash');
|
|
10
10
|
const AWS = require('aws-sdk');
|
|
11
11
|
|
|
12
|
+
function assertUrlProtocol(url) {
|
|
13
|
+
// Regex to test protocol like "http://", "https://"
|
|
14
|
+
return /^\w*:\/\//.test(url);
|
|
15
|
+
}
|
|
16
|
+
|
|
12
17
|
module.exports = {
|
|
13
18
|
init(config) {
|
|
14
19
|
const S3 = new AWS.S3({
|
|
@@ -34,7 +39,12 @@ module.exports = {
|
|
|
34
39
|
}
|
|
35
40
|
|
|
36
41
|
// set the bucket file url
|
|
37
|
-
|
|
42
|
+
if (assertUrlProtocol(data.Location)) {
|
|
43
|
+
file.url = data.Location;
|
|
44
|
+
} else {
|
|
45
|
+
// Default protocol to https protocol
|
|
46
|
+
file.url = `https://${data.Location}`;
|
|
47
|
+
}
|
|
38
48
|
|
|
39
49
|
resolve();
|
|
40
50
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/provider-upload-aws-s3",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.7",
|
|
4
4
|
"description": "AWS S3 provider for strapi upload",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"upload",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"node": ">=14.19.1 <=18.x.x",
|
|
45
45
|
"npm": ">=6.0.0"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "2a7549f5df12ac54adbc1cd6a3a773d53965a137"
|
|
48
48
|
}
|