Skip to content

Commit

Permalink
feat: alignment with mc client (#1339)
Browse files Browse the repository at this point in the history
  • Loading branch information
warjiang authored Oct 24, 2024
1 parent b79bfd5 commit 97981a1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/internal/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,14 @@ export class TypedClient {
const res = await this.makeRequestAsync({ method, bucketName, query, pathStyle }, '', [200], DEFAULT_REGION)
return extractRegionAsync(res)
} catch (e) {
// make alignment with mc cli
if (e instanceof errors.S3Error) {
const errCode = e.code
const errRegion = e.region
if (errCode === 'AccessDenied' && !errRegion) {
return DEFAULT_REGION
}
}
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
if (!(e.name === 'AuthorizationHeaderMalformed')) {
Expand Down

0 comments on commit 97981a1

Please sign in to comment.