Skip to content

Preserve non-string components when escaping build2 hashes - #250

Open
OskarEichler wants to merge 2 commits into
ruby:masterfrom
OskarEichler:codex/build2-uri
Open

Preserve non-string components when escaping build2 hashes#250
OskarEichler wants to merge 2 commits into
ruby:masterfrom
OskarEichler:codex/build2-uri

Conversation

@OskarEichler

Copy link
Copy Markdown

Summary

Escape only String components in the Hash fallback of build2, matching the existing Array fallback. Leave integer ports and nil components intact.

Reproduction

URI::HTTP.build2(host: 'example.test', port: 8080, path: '/a b') first retries because the path needs escaping, then raises NoMethodError when the retry tries to escape the integer port. Afterward, it returns http://example.test:8080/a%20b.

Verification

  • Ruby 4.0.6 through rbenv; existing bundle exec rake test: 93 tests / 3,039 assertions / zero failures or errors, both baseline and this isolated patch.
  • 48 checks cover HTTP/HTTPS/WS, nil/integer/string ports, query presence and unchanged input paths.
  • Syntax and git diff --check pass. Supplemental Lint adds no findings against the 31-finding baseline.
  • No test/spec files added or modified, per this contribution's explicit no-new-tests constraint. Focused reproductions ran externally.

Compatibility and limitations

Mixed-type component hashes that need escaping now succeed. Validation and the Array fallback are unchanged. No public API removal, dependency change or Ruby minimum change.

Based on master 696df43b0be4c05d3a0dcf7db582126c915d860d. Other Ruby/OS runtimes were not executed locally. No production traffic or live mail/FTP services were used. Existing related PRs/issues were checked; this is a focused contribution, not exhaustive behavioral coverage.

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