feat(types): Support Unicode in object metadata headers - #581
Open
jan-auer wants to merge 1 commit into
Open
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #581 +/- ##
==========================================
+ Coverage 87.62% 87.77% +0.14%
==========================================
Files 94 95 +1
Lines 15591 15718 +127
==========================================
+ Hits 13662 13796 +134
+ Misses 1929 1922 -7
☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Object metadata can now carry arbitrary Unicode. Previously a non-ASCII value failed the whole request with
400 Bad Requestand the message "error dealing with http headers". Headers only accept visible ASCII, so unicode was unstorable by any route.Metadata values are now percent-encoded at the transport layer.
Metadataitself is unchanged: it holds logicalStrings throughout, and escaping exists only where a value is written into a header. Additionally, non-ASCII filenames additionally get an RFC 8187filename*parameter onContent-Disposition, with the existing quoted-string kept as the ASCII fallback.Wire compatibility
Valid ASCII bytes pass through untouched, so values that are already plain ASCII are byte-identical to what they were before and existing clients see no change. The one visible difference is a value containing a literal
%, which is now escaped.The batch operation key header, which had its own hand-rolled
NON_ALPHANUMERICencoding in three places across two crates, now shares this set.Backends
Both header-based backends (GCS and S3) now store the escaped form.
GCS escapes on both of its write paths, including the JSON one that could carry Unicode verbatim. It follows Google's own advice: "you should generally avoid non-ascii characters, because they are not permitted in HTTP headers, which the XML API uses." The UTF-8-preserving behavior is undocumented, and raw UTF-8 additionally loses leading whitespace to header trimming and silently rewrites invalid UTF-8.
Not covered
Custom metadata keys are still ASCII-only and still lowercased by the header map, so
MyKeyround-trips asmykeyas it always has. Escaping keys would work but changes the wire form of every existing key without fixing the case-folding, so it is left alone.Fixes FS-467