picgo-plugin-s3 1.2.0 → 1.2.2
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/dist/index.js +0 -8
- package/dist/uploader.d.ts +1 -1
- package/dist/uploader.js +11 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
package/dist/uploader.d.ts
CHANGED
package/dist/uploader.js
CHANGED
|
@@ -3,13 +3,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
6
|
+
const aws_sdk_1 = require("aws-sdk");
|
|
7
7
|
const utils_1 = require("./utils");
|
|
8
|
+
const url_1 = __importDefault(require("url"));
|
|
8
9
|
function createS3Client(opts) {
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
let sslEnabled = true;
|
|
11
|
+
try {
|
|
12
|
+
const u = url_1.default.parse(opts.endpoint);
|
|
13
|
+
sslEnabled = u.protocol === "https:";
|
|
14
|
+
}
|
|
15
|
+
catch (_a) {
|
|
16
|
+
// eslint-disable-next-line no-empty
|
|
17
|
+
}
|
|
11
18
|
const http = sslEnabled ? require("https") : require("http");
|
|
12
|
-
const s3 = new
|
|
19
|
+
const s3 = new aws_sdk_1.S3({
|
|
13
20
|
region: opts.region,
|
|
14
21
|
endpoint: opts.endpoint,
|
|
15
22
|
accessKeyId: opts.accessKeyID,
|