mnemospark 0.9.1 → 0.9.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/cli.js CHANGED
@@ -4803,7 +4803,7 @@ function presignedPutBodyInit(encryptedContent, encryptedTempPath) {
4803
4803
  }
4804
4804
  throw new Error("Cannot upload storage object: missing encrypted payload body.");
4805
4805
  }
4806
- async function uploadPresignedObjectIfNeeded(uploadResponse, uploadMode, encryptedContent, encryptedTempPath, fetchImpl = fetch) {
4806
+ async function uploadPresignedObjectIfNeeded(uploadResponse, uploadMode, encryptedContent, encryptedTempPath, fetchImpl = fetch, presignedStreamContentLengthBytes) {
4807
4807
  if (!uploadResponse.upload_url) {
4808
4808
  if (uploadMode === "presigned") {
4809
4809
  throw new Error("Cannot upload storage object: missing presigned upload URL.");
@@ -4814,6 +4814,12 @@ async function uploadPresignedObjectIfNeeded(uploadResponse, uploadMode, encrypt
4814
4814
  if (!headers.has("content-type")) {
4815
4815
  headers.set("content-type", "application/octet-stream");
4816
4816
  }
4817
+ if (encryptedTempPath?.trim()) {
4818
+ const len = presignedStreamContentLengthBytes ?? (await stat2(encryptedTempPath.trim())).size;
4819
+ if (!headers.has("content-length")) {
4820
+ headers.set("content-length", String(len));
4821
+ }
4822
+ }
4817
4823
  const { body, duplex } = presignedPutBodyInit(encryptedContent, encryptedTempPath);
4818
4824
  const firstInit = {
4819
4825
  method: "PUT",
@@ -6370,7 +6376,8 @@ operation-id: ${operationId}`,
6370
6376
  preparedPayload.payload.mode,
6371
6377
  preparedPayload.encryptedContent,
6372
6378
  preparedPayload.encryptedTempPath,
6373
- fetchImpl
6379
+ fetchImpl,
6380
+ preparedPayload.encryptedTempPath ? preparedPayload.payload.content_length_bytes : void 0
6374
6381
  );
6375
6382
  let finalizedUploadResponse = uploadResponse;
6376
6383
  if (preparedPayload.payload.mode === "presigned" && uploadResponse.confirmation_required === true) {