@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/dist/index.js CHANGED
@@ -269,7 +269,7 @@ function assertStoredKey(key, keyPrefix) {
269
269
  }
270
270
  function objectKeyFileName(fileName) {
271
271
  const sanitized = sanitizeFileName(fileName);
272
- const leaf = sanitized.split("/").filter((part) => part.length > 0).at(-1);
272
+ const leaf = sanitized.split("/").findLast((part) => part.length > 0);
273
273
  if (!leaf || leaf === "." || leaf === "..") return "file";
274
274
  return leaf;
275
275
  }
@@ -361,7 +361,7 @@ function skippedPluginIds(plugins) {
361
361
  const ids = /* @__PURE__ */ new Set();
362
362
  if (!plugins) return ids;
363
363
  for (const [id, enabled] of Object.entries(plugins)) {
364
- if (enabled === false) ids.add(id);
364
+ if (!enabled) ids.add(id);
365
365
  }
366
366
  return ids;
367
367
  }
@@ -599,7 +599,7 @@ async function finalizeConfirmedObject(client, bucket, key, input) {
599
599
  ...stored,
600
600
  contentType: head.ContentType,
601
601
  contentLength,
602
- eTag: head.ETag?.replace(/"/g, ""),
602
+ eTag: head.ETag?.replaceAll('"', ""),
603
603
  metadata,
604
604
  acl,
605
605
  fileName,
@@ -979,7 +979,7 @@ async function handleFile(config, input, request) {
979
979
  new GetObjectCommand({
980
980
  Bucket: bucket,
981
981
  Key: key,
982
- ResponseContentDisposition: fileName ? buildContentDisposition(fileName, disposition) : `${disposition}`
982
+ ResponseContentDisposition: fileName ? buildContentDisposition(fileName, disposition) : disposition
983
983
  })
984
984
  )
985
985
  );
@@ -990,7 +990,7 @@ async function handleFile(config, input, request) {
990
990
  headers.set("Content-Type", result.ContentType ?? "application/octet-stream");
991
991
  headers.set(
992
992
  "Content-Disposition",
993
- fileName ? buildContentDisposition(fileName, disposition) : `${disposition}`
993
+ fileName ? buildContentDisposition(fileName, disposition) : disposition
994
994
  );
995
995
  if (typeof result.ContentLength === "number") {
996
996
  headers.set("Content-Length", String(result.ContentLength));
@@ -1053,7 +1053,7 @@ async function handleComplete(config, input, request) {
1053
1053
  const uploadId = input.uploadId;
1054
1054
  const parts = [
1055
1055
  ...new Set(input.parts.map(({ partNumber }) => partNumber))
1056
- ].sort((a, b) => a - b);
1056
+ ].toSorted((a, b) => a - b);
1057
1057
  const partRefs = parts.map((partNumber) => ({ partNumber }));
1058
1058
  await runHook(route2.upload.multipart.guard, {
1059
1059
  ...stored,
@@ -1243,7 +1243,7 @@ async function handleListParts(config, input, request) {
1243
1243
  {
1244
1244
  partNumber: p.PartNumber,
1245
1245
  size: p.Size ?? 0,
1246
- eTag: (p.ETag ?? "").replace(/"/g, "")
1246
+ eTag: (p.ETag ?? "").replaceAll('"', "")
1247
1247
  }
1248
1248
  ];
1249
1249
  });
@@ -1664,7 +1664,7 @@ function applyPlugins(config) {
1664
1664
  const endpoints = {};
1665
1665
  for (const plugin of plugins) {
1666
1666
  for (const [name, endpoint] of Object.entries(plugin.endpoints ?? {})) {
1667
- if (reservedNames.has(name) || name in endpoints) {
1667
+ if (reservedNames.has(name) || Object.hasOwn(endpoints, name)) {
1668
1668
  throw new Error(
1669
1669
  `Plugin "${plugin.id}" endpoint "${name}" collides with an existing endpoint.`
1670
1670
  );