cloudyr / googleCloudStorageR

Google Cloud Storage API to R
https://code.markedmondson.me/googleCloudStorageR
Other
104 stars 29 forks source link

Certain API URLs contain a trailing whitespace that is not documented #178

Closed manuteleco closed 1 year ago

manuteleco commented 1 year ago

This is an observation of something I've encountered when working on #176. It's not a critical issue; whether or not it requires action is for you to decide. So feel free to just close this issue if you believe no adjustments are required.

On GCS API methods that use URLs ending with /o or /b, googleCloudStorageR will actually perform requests to /o/ and /b/ instead. It adds an extra trailing slash to the path. This obviously still works fine in practice, as Google seems to be lenient here. But its official documentation doesn't say anything about supporting that trailing slash. For example, see the reference document for the Objects: insert operation.

Despite working with the real GCS, the fact that googleCloudStorageR relies on URLs that are undocumented can still lead to other minor issues. For example, it might not work out of the box with GCS emulators unless they are given explicit support for the undocumented routes, like in https://github.com/fsouza/fake-gcs-server/pull/1252.

MarkEdmondson1234 commented 1 year ago

There is actually an option to remove the check for a trailing space, I remember it came up off and on which Google APIs supported it or not https://github.com/MarkEdmondson1234/googleAuthR/blob/3e77935ec7dcb205b8f93110c9f5d7306ae0938d/R/generator.R#L13

manuteleco commented 1 year ago

Thanks, I hadn't noticed that option. Together with another minor adjustment, I managed to remove the trailing slash from the URLs I mentioned.

I'll wait for https://github.com/cloudyr/googleCloudStorageR/pull/177 to be merged before opening a PR, in order to avoid conflicts.