Conversation
Fixes three issues with the encoding/decoding of strings: 1. Namespace segments are escaped as paths instead of queries to match how they are unescaped. 2. Subpath segments are escaped to match how they are unescaped. 3. Names are unescaped to match how they are escaped. A test is added to ensure this is enforced for all components requiring encoding. Five tests cases failed previous to the change: 1. unencoded_namespace_segment_is_encoded: expected pkg:type/name/spac e/name@version?key=value#sub/path to parse as pkg:type/name/spac%20e/name@version?key=value#sub/path but got pkg:type/name/spac+e/name@version?key=value#sub/path 2. pre-encoded_namespace_segment_is_unchanged: expected pkg:type/name/spac%20e/name@version?key=value#sub/path to parse as pkg:type/name/spac%20e/name@version?key=value#sub/path but got pkg:type/name/spac+e/name@version?key=value#sub/path 3. pre-encoded_name_is_unchanged: expected pkg:type/name/space/nam%20e@version?key=value#sub/path to parse as pkg:type/name/space/nam%20e@version?key=value#sub/path but got pkg:type/name/space/nam%2520e@version?key=value#sub/path 4. unencoded_subpath_segment_is_encoded: expected pkg:type/name/space/name@version?key=value#sub/pat h to parse as pkg:type/name/space/name@version?key=value#sub/pat%20h but got pkg:type/name/space/name@version?key=value#sub/pat h 5. pre-encoded_subpath_segment_is_unchanged: expected pkg:type/name/space/name@version?key=value#sub/pat%20h to parse as pkg:type/name/space/name@version?key=value#sub/pat%20h but got pkg:type/name/space/name@version?key=value#sub/pat h Signed-off-by: Keith Zantow <kzantow@gmail.com>
54a515a to
2921588
Compare
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.
Fixes three issues with the encoding/decoding of strings:
how they are unescaped.
A test is added to ensure this is enforced for all components requiring
encoding. Five tests cases failed previous to the change:
expected pkg:type/name/spac e/name@version?key=value#sub/path
to parse as pkg:type/name/spac%20e/name@version?key=value#sub/path
but got pkg:type/name/spac+e/name@version?key=value#sub/path
expected pkg:type/name/spac%20e/name@version?key=value#sub/path
to parse as pkg:type/name/spac%20e/name@version?key=value#sub/path
but got pkg:type/name/spac+e/name@version?key=value#sub/path
expected pkg:type/name/space/nam%20e@version?key=value#sub/path
to parse as pkg:type/name/space/nam%20e@version?key=value#sub/path
but got pkg:type/name/space/nam%2520e@version?key=value#sub/path
expected pkg:type/name/space/name@version?key=value#sub/pat h
to parse as pkg:type/name/space/name@version?key=value#sub/pat%20h
but got pkg:type/name/space/name@version?key=value#sub/pat h
expected pkg:type/name/space/name@version?key=value#sub/pat%20h
to parse as pkg:type/name/space/name@version?key=value#sub/pat%20h
but got pkg:type/name/space/name@version?key=value#sub/pat h