Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is not really accurate. It's valid to generate a URL without a Content-Type header (e.g. for a GET request), so the field is definitely not required in SignedURLOptions.
Moreover from the docs (https://cloud.google.com/storage/docs/authentication/canonical-requests#about-headers) it sounds like content-type is not a required canonical header, so you should be able to add it to the request after signing.
Maybe there is a server side issue here? Let me know if you think I'm mistaken, or you can file an issue with support to share details about the error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just believe it's misleading... I imagined that omitting the ContentType would make it so it accepts any kind of content type, this in fact was not the case and the only accepted content type was that of an empty string... Not to mention the fact that in a client-side/browser setting if you omit the content-type from the header the browser will automatically put in a "guess" for the content-type of the file that you are uploading, which would then be rejected since the only accepted content type would be ""... Results in a really nasty bug..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is something i wrote quite a while ago that might help you understand my frustration. blog
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay so I investigated this further and it looks like you are using v2 signing, while the docs I linked to are for v4.
We recommend v4 signing generally and it does something more like what you want (at least according to the docs). Can you try that out by setting https://pkg.go.dev/cloud.google.com/go/storage#SignedURLOptions.Scheme ?
I think we could improve the docs here for v2, but I would definitely not want to mark this field as required in any case since it is not required for most signed URLs.