@dimah-s3/server 1.5.7 → 1.5.9
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/LICENSE +1 -1
- package/dist/adapters/express.js +9 -9
- package/dist/adapters/express.js.map +1 -1
- package/dist/adapters/fastify.js +9 -9
- package/dist/adapters/fastify.js.map +1 -1
- package/dist/adapters/node.js +9 -9
- package/dist/adapters/node.js.map +1 -1
- package/dist/api/bind-endpoints.d.ts +1 -1
- package/dist/api/bind-endpoints.d.ts.map +1 -1
- package/dist/api/index.js +6 -6
- package/dist/api/index.js.map +1 -1
- package/dist/api/routes/file.d.ts.map +1 -1
- package/dist/dimah-s3.d.ts +2 -2
- package/dist/dimah-s3.d.ts.map +1 -1
- package/dist/helpers/resolve-target.d.ts.map +1 -1
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/dist/plugins.js +8 -8
- package/dist/plugins.js.map +1 -1
- package/package.json +19 -18
package/dist/plugins.js
CHANGED
|
@@ -263,7 +263,7 @@ function assertStoredKey(key, keyPrefix) {
|
|
|
263
263
|
}
|
|
264
264
|
function objectKeyFileName(fileName) {
|
|
265
265
|
const sanitized = sanitizeFileName(fileName);
|
|
266
|
-
const leaf = sanitized.split("/").
|
|
266
|
+
const leaf = sanitized.split("/").findLast((part) => part.length > 0);
|
|
267
267
|
if (!leaf || leaf === "." || leaf === "..") return "file";
|
|
268
268
|
return leaf;
|
|
269
269
|
}
|
|
@@ -352,7 +352,7 @@ function skippedPluginIds(plugins) {
|
|
|
352
352
|
const ids = /* @__PURE__ */ new Set();
|
|
353
353
|
if (!plugins) return ids;
|
|
354
354
|
for (const [id, enabled] of Object.entries(plugins)) {
|
|
355
|
-
if (enabled
|
|
355
|
+
if (!enabled) ids.add(id);
|
|
356
356
|
}
|
|
357
357
|
return ids;
|
|
358
358
|
}
|
|
@@ -595,7 +595,7 @@ async function finalizeConfirmedObject(client, bucket, key, input) {
|
|
|
595
595
|
...stored,
|
|
596
596
|
contentType: head.ContentType,
|
|
597
597
|
contentLength,
|
|
598
|
-
eTag: head.ETag?.
|
|
598
|
+
eTag: head.ETag?.replaceAll('"', ""),
|
|
599
599
|
metadata,
|
|
600
600
|
acl,
|
|
601
601
|
fileName,
|
|
@@ -906,7 +906,7 @@ async function handleFile(config, input, request) {
|
|
|
906
906
|
new GetObjectCommand({
|
|
907
907
|
Bucket: bucket,
|
|
908
908
|
Key: key,
|
|
909
|
-
ResponseContentDisposition: fileName ? buildContentDisposition(fileName, disposition) :
|
|
909
|
+
ResponseContentDisposition: fileName ? buildContentDisposition(fileName, disposition) : disposition
|
|
910
910
|
})
|
|
911
911
|
)
|
|
912
912
|
);
|
|
@@ -917,7 +917,7 @@ async function handleFile(config, input, request) {
|
|
|
917
917
|
headers.set("Content-Type", result.ContentType ?? "application/octet-stream");
|
|
918
918
|
headers.set(
|
|
919
919
|
"Content-Disposition",
|
|
920
|
-
fileName ? buildContentDisposition(fileName, disposition) :
|
|
920
|
+
fileName ? buildContentDisposition(fileName, disposition) : disposition
|
|
921
921
|
);
|
|
922
922
|
if (typeof result.ContentLength === "number") {
|
|
923
923
|
headers.set("Content-Length", String(result.ContentLength));
|
|
@@ -980,7 +980,7 @@ async function handleComplete(config, input, request) {
|
|
|
980
980
|
const uploadId = input.uploadId;
|
|
981
981
|
const parts = [
|
|
982
982
|
...new Set(input.parts.map(({ partNumber }) => partNumber))
|
|
983
|
-
].
|
|
983
|
+
].toSorted((a, b) => a - b);
|
|
984
984
|
const partRefs = parts.map((partNumber) => ({ partNumber }));
|
|
985
985
|
await runHook(route.upload.multipart.guard, {
|
|
986
986
|
...stored,
|
|
@@ -1170,7 +1170,7 @@ async function handleListParts(config, input, request) {
|
|
|
1170
1170
|
{
|
|
1171
1171
|
partNumber: p.PartNumber,
|
|
1172
1172
|
size: p.Size ?? 0,
|
|
1173
|
-
eTag: (p.ETag ?? "").
|
|
1173
|
+
eTag: (p.ETag ?? "").replaceAll('"', "")
|
|
1174
1174
|
}
|
|
1175
1175
|
];
|
|
1176
1176
|
});
|
|
@@ -1591,7 +1591,7 @@ function applyPlugins(config) {
|
|
|
1591
1591
|
const endpoints = {};
|
|
1592
1592
|
for (const plugin of plugins) {
|
|
1593
1593
|
for (const [name, endpoint] of Object.entries(plugin.endpoints ?? {})) {
|
|
1594
|
-
if (reservedNames.has(name) || name
|
|
1594
|
+
if (reservedNames.has(name) || Object.hasOwn(endpoints, name)) {
|
|
1595
1595
|
throw new Error(
|
|
1596
1596
|
`Plugin "${plugin.id}" endpoint "${name}" collides with an existing endpoint.`
|
|
1597
1597
|
);
|