GoogleCloudPlatform / google-cloud-powershell

PowerShell cmdlets for the Google Cloud Platform
http://googlecloudplatform.github.io/google-cloud-powershell/
Apache License 2.0
135 stars 61 forks source link

Provider tool "ls" or "dir" to list folder objects breaks when Cloud Storage bucket objects >1,000 #650

Open KennyCCK opened 3 years ago

KennyCCK commented 3 years ago

Documentation:

Summary:

PS gs:\bucketTest> dir

   ParentPath: bucketTest

Name                Size ContentType TimeCreated Updated
----                ---- ----------- ----------- -------
A
B
C

PS gs:\bucketTest> dir B
dir : Cannot find path 'bucketTest\B' because it does not exist.
At line:1 char:1
+ dir B
+ ~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (bucketTest\B:String) [Get-ChildItem], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand

Debug/Troubleshoot details:

Reproduction steps:

1) Create bucketTest with folder "A", "B", and "C" 2) Upload 1,010 objects to folder "A" 3) Open Powershell (assuming necessary configs are done) 4) Enter cd gs:\ 5) PS gs:\> cd bucketTest 6) PS gs:\bucketTest> ls B (ItemNotFoundException expected to occur here)

References:

[1] https://github.com/GoogleCloudPlatform/google-cloud-powershell/blob/b0549f98b2a150830ff6ddf10c66c3252df7626d/Google.PowerShell/Provider/GoogleCloudStorageProvider.cs#L390

[2] https://github.com/GoogleCloudPlatform/google-cloud-powershell/blob/b0549f98b2a150830ff6ddf10c66c3252df7626d/Google.PowerShell/Provider/BucketModel.cs#L108

[3] https://cloud.google.com/storage/docs/json_api/v1/objects/list#maxResults

Current Workaround

The following works fine and offer similar object listing results for Cloud Storage bucket folder: