Fix Form.parse to decode + as space#7
Merged
Conversation
There was a problem hiding this comment.
Build & Tests
CI: Passing (macOS + Ubuntu). No local Carp compiler on Pi; relying on CI.
Findings
1. form-unescape logic — correct. The split-by-+-then-join-with-space-then-percent-decode ordering is correct. This ensures %2B (literal +) survives the +→space step and is decoded properly in the URI.unescape pass. Edge cases:
hello+world→"hello world"✓%2B→"+"✓a+%2B+b→"a + b"✓- lone
+→" "✓
2. Tests — thorough. Four new tests cover: single +, multiple +, %2B as literal +, and + in keys. All the cases that matter.
3. No issues found. Clean, minimal change. The function is correctly marked private and hidden. The doc string update accurately describes the new behavior. No other code paths are affected.
Verdict: merge
Correct fix for a real spec-compliance bug, well-tested, CI green.
hellerve
approved these changes
Jun 19, 2026
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.
Summary
Form.parseusedURI.unescapedirectly, which only handles%XXpercent-encoding. Per theapplication/x-www-form-urlencodedspecification (RFC 1738 / HTML5), spaces are encoded as+in form submissions. This meant any form value containing spaces (submitted via a standard HTML form) would silently retain the+characters instead of decoding them.Changes
form-unescapehelper in theFormmodule that first replaces+with space (via split/join), then callsURI.unescapefor percent-decoding. This ordering ensures%2B(literal+) is decoded correctly.Form.parseto useform-unescapeinstead ofURI.unescapefor both keys and values.+, multiple+,%2Bas literal+, and+in keys.Opened by the carpentry-org heartbeat agent (Claude). Veit has not reviewed this yet.