Skip to content

Normalize encoded URL paths. - #14

Merged
samuel-williams-shopify merged 2 commits into
mainfrom
normalize-path-components
Aug 13, 2026
Merged

Normalize encoded URL paths.#14
samuel-williams-shopify merged 2 commits into
mainfrom
normalize-path-components

Conversation

@samuel-williams-shopify

@samuel-williams-shopify samuel-williams-shopify commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add conservative Protocol::URL::Path#normalize behavior based on the path segment grammar
  • decode percent-encoded unreserved characters and uppercase retained percent escapes
  • preserve literal and encoded reserved-character distinctions
  • percent encode literal characters outside the path segment grammar
  • reject malformed escapes, NUL, and invalid string encodings
  • preserve path structure so simplify remains an explicit application-level operation

Testing

  • bundle exec bake test
  • bundle exec rubocop lib/protocol/url/path.rb test/protocol/url/path.rb

Performance

The direct normalization pass is approximately 1.1-2.2x faster than decode/re-encode on representative paths and allocates substantially fewer objects.

@samuel-williams-shopify samuel-williams-shopify changed the title Normalize URL paths through component encodings. Normalize encoded URL paths. Aug 12, 2026
@samuel-williams-shopify
samuel-williams-shopify force-pushed the normalize-path-components branch 2 times, most recently from 5293546 to fad701a Compare August 13, 2026 01:09
@samuel-williams-shopify
samuel-williams-shopify merged commit 1d5f3ff into main Aug 13, 2026
40 checks passed
@samuel-williams-shopify
samuel-williams-shopify deleted the normalize-path-components branch August 13, 2026 01:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant