storage: Reader uses the xml api but sends json preconditions #4470
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.
NewRangerReader
uses the XML api to download files.conditionsQuery()
uses the JSON API to configure preconditionsNewRangerReader
callsconditionsQuery()
rather than setting the expected precondition headers.ObjectHandle.NewReader()
callsNewRangeReader
:google-cloud-go/storage/reader.go
Lines 79 to 81 in 5ac09d9
This eventually sets
req.URL.RawQuery = conditionsQuery(gen, o.conds)
:google-cloud-go/storage/reader.go
Lines 151 to 152 in 5ac09d9
conditionsQuery()
appends the applicable JSON API URL parameters:google-cloud-go/storage/storage.go
Lines 1620 to 1633 in 5ac09d9
However, the
readHost
is not the json api, it is the xml api:google-cloud-go/storage/storage.go
Line 118 in 5ac09d9
The xml API expects an
x-goog-if-generation-match
header. It does not recognize the JSON API's url parameters.Thus the following will always work and never return the expected preconditon error:
The text was updated successfully, but these errors were encountered: