Skip to content

[s3.copyObject]: Invalid character in header content ["x-amz-copy-source"] #6596

@shadoworion

Description

@shadoworion

Checkboxes for prior research

Describe the bug

It looks like the "copyObject" function does not support Hebrew in the location path.

Regression Issue

  • Select this option if this issue appears to be a regression.

SDK version number

@aws-sdk/[email protected]

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

22.8.0

Reproduction Steps

const oldLocation = "Files/ce59edb1-c78a-4e47-9cc1-b631b3f6e03b/דוד-טסט_orders_2024-10-28 (2).csv";
const newLocation = "Files/236bf060-db65-45fb-be2a-8d5845a75f6d/דוד-טסט_orders_2024-10-28 (2).csv";

await s3.copyObject({
      CopySource: `${process.env.AWS_STORAGE_BUCKET}/${oldLocation}`,
      Bucket: process.env.AWS_STORAGE_BUCKET,
      Key: newLocation,
});

Observed Behavior

TypeError: Invalid character in header content ["x-amz-copy-source"]
    at ClientRequest.setHeader (node:_http_outgoing:702:3)
    at new ClientRequest (node:_http_client:295:14)
    at request (node:https:379:10)
    at /backend/node_modules/@smithy/node-http-handler/dist-cjs/index.js:349:19
    at new Promise (<anonymous>)
    at _NodeHttpHandler.handle (/backend/node_modules/@smithy/node-http-handler/dist-cjs/index.js:283:12)
    at /backend/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/index.js:534:18
    at /backend/node_modules/@smithy/middleware-serde/dist-cjs/index.js:33:24
    at /backend/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/index.js:485:18
    at /backend/node_modules/@smithy/middleware-retry/dist-cjs/index.js:320:38 {
  code: 'ERR_INVALID_CHAR',
  '$metadata': { attempts: 1, totalRetryDelay: 0 }
}

Expected Behavior

Not to get an error

Possible Solution

No response

Additional Information/Context

No response

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.p2This is a standard priority issueservice-apiThis issue is due to a problem in a service API, not the SDK implementation.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions