Description
- Specify the API at the beginning of the title (for example, "BigQuery: ...")
General, Core, and Other are also allowed as types
✅ - OS type and version
I use the Storage lib inside aCloud Function
(Python Beta runntime) - Python version and virtual environment information
python --version
3.7 - google-cloud-python version
pip show google-cloud
,pip show google-<service>
orpip freeze
1.12.0 - Stacktrace if available
❌ - Steps to reproduce
❌ - Code example
👇
Hey guys 👋
currently I experiment a little bit with the Cloud Storage library inside a Cloud Function.
For testing I want to make an already uploaded file available via Blob#generate_signed_url
.
The thing is - it works. I have no issues.
But Yesterday I spend at least 6 hours for testing it because the method
in the generated_signed_url
needs to be in uppercase.
Meaning the following does not work:
blob.generate_signed_url(timedelta(minutes=5), "get")
but this works:
blob.generate_signed_url(timedelta(minutes=5), "GET")
After a quick look into your code I found out that you "just put" the string into the generated URL. Without validating if that is a valid HTTP-Method!
https://github.com/GoogleCloudPlatform/google-cloud-python/blob/81bc5ef11d1918580f41e9f8ee2c9be2529b1169/storage/google/cloud/storage/_signing.py#L189
I would recommend (or request with this issue 🙃 ) to either:
- Check if the given string is a valid HTTP-Method (POST, GET, PUT etc.) and make the string to uppercase!
- Or better (but leads to breaking changes (maybe 😃)) make an ENUM of it and only allow to put an enum-value into the method.