Skip to content

Commit

Permalink
Make S3Client methods Encode URI before signing
Browse files Browse the repository at this point in the history
  • Loading branch information
oleiade committed May 27, 2024
1 parent fbb4568 commit b8678e4
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/internal/s3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export class S3Client extends AWSClient {
{
method: method,
endpoint: this.endpoint,
path: `/${bucketName}/`,
path: encodeURI(`/${bucketName}/`),
query: {
'list-type': '2',
prefix: prefix || '',
Expand Down Expand Up @@ -176,13 +176,13 @@ export class S3Client extends AWSClient {
{
method: method,
endpoint: this.endpoint,
path: `/${bucketName}/${objectKey}`,
path: encodeURI(`/${bucketName}/${objectKey}`),
headers: {},
},
{}
)

const res = await http.asyncRequest(method, signedRequest.url, signedRequest.body || null, {
const res = await http.asyncRequest(method, signedRequest.url, null, {
headers: signedRequest.headers,
})
this._handle_error('GetObject', res)
Expand Down Expand Up @@ -224,7 +224,7 @@ export class S3Client extends AWSClient {
{
method: method,
endpoint: this.endpoint,
path: `/${bucketName}/${objectKey}`,
path: encodeURI(`/${bucketName}/${objectKey}`),
headers: {
Host: this.endpoint.host,
...(params?.contentDisposition && {
Expand Down Expand Up @@ -263,7 +263,7 @@ export class S3Client extends AWSClient {
{
method: method,
endpoint: this.endpoint,
path: `/${bucketName}/${objectKey}`,
path: encodeURI(`/${bucketName}/${objectKey}`),
headers: {},
},
{}
Expand Down Expand Up @@ -300,7 +300,7 @@ export class S3Client extends AWSClient {
{
method: method,
endpoint: bucketEndpoint,
path: `/${destinationKey}`,
path: encodeURI(`/${destinationKey}`),
headers: {
'x-amz-copy-source': `${sourceBucket}/${sourceKey}`,
},
Expand Down Expand Up @@ -335,7 +335,7 @@ export class S3Client extends AWSClient {
{
method: method,
endpoint: bucketEndpoint,
path: `/${objectKey}`,
path: encodeURI(`/${objectKey}`),
headers: {},
query: { uploads: '' },
},
Expand Down Expand Up @@ -381,7 +381,7 @@ export class S3Client extends AWSClient {
{
method: method,
endpoint: bucketEndpoint,
path: `/${objectKey}`,
path: encodeURI(`/${objectKey}`),
headers: {},
body: data,
query: {
Expand Down Expand Up @@ -432,7 +432,7 @@ export class S3Client extends AWSClient {
{
method: method,
endpoint: bucketEndpoint,
path: `/${objectKey}`,
path: encodeURI(`/${objectKey}`),
headers: {},
body: body,
query: {
Expand Down Expand Up @@ -468,7 +468,7 @@ export class S3Client extends AWSClient {
{
method: method,
endpoint: bucketEndpoint,
path: `/${objectKey}`,
path: encodeURI(`/${objectKey}`),
headers: {},
query: {
uploadId: `${uploadId}`,
Expand Down

0 comments on commit b8678e4

Please sign in to comment.