kap-r2 1.0.4 → 1.0.5
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 +4 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -51,11 +51,12 @@ const action = async (context) => {
|
|
|
51
51
|
const key = directory ? path_1.default.posix.join(directory, filename) : filename;
|
|
52
52
|
const extension = path_1.default.extname(filename);
|
|
53
53
|
const contentType = contentTypes.get(extension) || "application/octet-stream";
|
|
54
|
-
const host = `${
|
|
54
|
+
const host = `${accountId}.r2.cloudflarestorage.com`;
|
|
55
55
|
const encodedKey = key.split("/").map(encodeURIComponent).join("/");
|
|
56
|
+
const fullPath = `/${bucket}/${encodedKey}`;
|
|
56
57
|
const request = aws4_1.default.sign({
|
|
57
58
|
host,
|
|
58
|
-
path:
|
|
59
|
+
path: fullPath,
|
|
59
60
|
method: "PUT",
|
|
60
61
|
headers: {
|
|
61
62
|
"Content-Type": contentType,
|
|
@@ -72,7 +73,7 @@ const action = async (context) => {
|
|
|
72
73
|
await new Promise((resolve, reject) => {
|
|
73
74
|
const req = https_1.default.request({
|
|
74
75
|
hostname: host,
|
|
75
|
-
path:
|
|
76
|
+
path: fullPath,
|
|
76
77
|
method: "PUT",
|
|
77
78
|
headers: request.headers,
|
|
78
79
|
}, (res) => {
|