@beam-network/sdk 0.2.7 → 0.2.8

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.
@@ -107,6 +107,17 @@ export async function signUploadPartCopy(destination, finalObjectKey, stagingObj
107
107
  if (isS3CompatibleProvider(destination)) {
108
108
  const client = createS3CompatibleClient(destination);
109
109
  const copySource = copySourceHeader(destination, stagingObjectKey);
110
+ // Keep x-amz-copy-source (and x-amz-copy-source-range when present) in
111
+ // X-Amz-SignedHeaders rather than hoisting them to URL query params.
112
+ // The JS AWS SDK default hoists all x-amz-* headers to query params for
113
+ // presigned URLs; R2 ignores copy-source from query params (zero-byte copy)
114
+ // and returns SignatureDoesNotMatch when they are sent as unsigned headers
115
+ // alongside the signed query value. Keeping them as signed headers matches
116
+ // boto3 behavior and the copySourceHeaders replay contract in core-server.
117
+ const unhoistableHeaders = new Set(["x-amz-copy-source"]);
118
+ if (copySourceRange) {
119
+ unhoistableHeaders.add("x-amz-copy-source-range");
120
+ }
110
121
  return {
111
122
  copySource,
112
123
  copyUrl: await getSignedUrl(client, new UploadPartCopyCommand({
@@ -116,7 +127,7 @@ export async function signUploadPartCopy(destination, finalObjectKey, stagingObj
116
127
  PartNumber: partNumber,
117
128
  CopySource: copySource,
118
129
  CopySourceRange: copySourceRange
119
- }), { expiresIn })
130
+ }), { expiresIn, unhoistableHeaders })
120
131
  };
121
132
  }
122
133
  throw new Error(`multipart copy is not supported for ${destination.provider}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beam-network/sdk",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
4
4
  "description": "TypeScript SDK for BEAM transfer creation and management.",
5
5
  "type": "module",
6
6
  "license": "MIT",