Skip to content

Commit ba3a4f7

Browse files
authored
fix(S3 View): Display bucket contents with specific IAM role policies aws#4644
## Problem: S3 tree view doesn't show contents with specific IAM role policies. Prefix parameter was null. ## Solution: Set Prefix parameter to an empty string as default. Allows bucket contents display if root prefix is allowed. ref: aws#4643
1 parent 61d6cb1 commit ba3a4f7

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "Bug Fix",
3+
"description": "Resource Explorer: S3 tree view now shows bucket contents correctly, even when restricted to root prefix."
4+
}

packages/core/src/shared/clients/s3Client.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { toStream } from '../utilities/collectionUtils'
1919

2020
export const DEFAULT_MAX_KEYS = 300 // eslint-disable-line @typescript-eslint/naming-convention
2121
export const DEFAULT_DELIMITER = '/' // eslint-disable-line @typescript-eslint/naming-convention
22+
export const defaultPrefix = ''
2223

2324
export type Bucket = InterfaceNoSymbol<DefaultBucket>
2425
export type Folder = InterfaceNoSymbol<DefaultFolder>
@@ -460,7 +461,13 @@ export class DefaultS3Client {
460461
Bucket: bucket.name,
461462
Delimiter: DEFAULT_DELIMITER,
462463
MaxKeys: request.maxResults ?? DEFAULT_MAX_KEYS,
463-
Prefix: request.folderPath,
464+
/**
465+
* Set '' as the default prefix to ensure that the bucket's content will be displayed
466+
* when the user has at least list access to the root of the bucket.
467+
* https://github.com/aws/aws-toolkit-vscode/issues/4643
468+
* @default ''
469+
*/
470+
Prefix: request.folderPath ?? defaultPrefix,
464471
ContinuationToken: request.continuationToken,
465472
})
466473
.promise()

0 commit comments

Comments
 (0)