aws / aws-tools-for-powershell

The AWS Tools for PowerShell lets developers and administrators manage their AWS services from the PowerShell scripting environment.
Apache License 2.0
235 stars 77 forks source link

Read-S3Object with -KeyPrefix doesn't work #265

Closed rpmrmartin closed 1 year ago

rpmrmartin commented 2 years ago

Describe the bug

Read-S3Object doesn't download any objects when -KeyPrefix is specified.

Expected Behavior

All the objects in the specified bucket with the specified key prefix are downloaded to the specified folder.

Current Behavior

No objects are downloaded.

image

Reproduction Steps

Run Read-S3Object, specifying -BucketName, -KeyPrefix, and -Folder.

Possible Solution

No response

Additional Information/Context

No response

AWS Tools for PowerShell version used

4.1.89

PowerShell version used

Name Value
PSVersion 7.2.4
PSEdition Core
GitCommitId 7.2.4
OS Microsoft Windows 10.0.19044
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

Operating System and version

Windows 10 Pro for Workstations 21H2 19044.1706

ashishdhingra commented 2 years ago

Reproducible.

namespace TransferUtilityDownloadDirectoryTest { class Program { static string bucketName = "<>"; static string localDirectory = "<>"; static string keyPrefix = "rpmdev/2022-04-29";

    static void Main(string[] args)
    {
        var request = new TransferUtilityDownloadDirectoryRequest
        {
            BucketName = bucketName,
            LocalDirectory = localDirectory,
            S3Directory = keyPrefix
        };

        using (var tu = new TransferUtility(new AmazonS3Client()))
        {
            tu.DownloadDirectory(request);
        }
    }
}

}

github-actions[bot] commented 1 year ago

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

ashishdhingra commented 1 year ago

We have implemented new parameter DisableSlashCorrection for Read-S3Object in the AWS Tools for PowerShell version 4.1.132. Please set this parameter to $true for your scenario which would then not add trailing / to the KeyPrefix value.

github-actions[bot] commented 1 year ago

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.