Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

storage: ErrObjectNotExist in NewRangeReader for "./" prefixed objects #7236

Closed
wimagguc opened this issue Jan 10, 2023 · 1 comment · Fixed by #8017
Closed

storage: ErrObjectNotExist in NewRangeReader for "./" prefixed objects #7236

wimagguc opened this issue Jan 10, 2023 · 1 comment · Fixed by #8017
Assignees
Labels
api: storage Issues related to the Cloud Storage API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@wimagguc
Copy link

wimagguc commented Jan 10, 2023

Client

Storage

Environment

MacOS

Go Environment

$ go version

go version go1.18.7 darwin/arm64

Code

NOTE in the following examples, both gs://bucket/object1.mcap and gs://bucket/./object1.mcap objects exist (and are copies of one another).

handle := gcs.Bucket(bucketName).Object("object1.mcap")
fmt.Println(handle.Attrs(ctx))
// Prints the attributes for `object1.mcap`
r, err := handle.NewRangeReader(ctx, 0, -1)
// Works as expected, no error.

Compare to:

handle := gcs.Bucket(bucketName).Object("./object1.mcap")
fmt.Println(handle.Attrs(ctx))
// Prints the attributes for `./object1.mcap` as above
r, err := handle.NewRangeReader(ctx, 0, -1)
// Error: `storage: object doesn't exist`

Expected behavior

Running the same script for both existing objects, they should behave the same. The "./" object prefix shouldn't cause unexpected issues.

Actual behavior

  • There's no difference in handle.Attrs(ctx) — this prints the same for both ./object1.mcap and object1.mcap
  • But handle.NewRangeReader(ctx, 0, -1) works for object1.mcap only, and displays an error for ./object1.mcap:
storage: object doesn't exist

Additional context

NOTE that x/object1.mcap or other paths will work as well, the only exception so far being the ./ prefix. Objects with "./" prefix should be legitimate.

@wimagguc wimagguc added the triage me I really want to be triaged. label Jan 10, 2023
@product-auto-label product-auto-label bot added the api: storage Issues related to the Cloud Storage API. label Jan 10, 2023
@BrennaEpp BrennaEpp added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. priority: p2 Moderately-important priority. Fix may not be included in next release. and removed triage me I really want to be triaged. labels Jan 11, 2023
@BrennaEpp BrennaEpp assigned BrennaEpp and unassigned tritone Jan 11, 2023
@tritone
Copy link
Contributor

tritone commented Feb 27, 2023

Hey, apologies for the belated response on this. We are looking into the issue; however, it may be a limitation on characters in the XML API, which is used for downloads by the SDK by default.

However, we have recently added support for downloads via the JSON API. I tested and validated that a filename like the one you mention works via this route. See https://pkg.go.dev/cloud.google.com/go/storage@main#WithJSONReads for how to enable. (Note that this will be going out in storage/v1.30.0, which we plan on releasing this week).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the Cloud Storage API. priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants