Skip to content

REST requests: decode any %XX escape, once - #55

Merged
robdobsn merged 3 commits into
mainfrom
fix/url-decode-escapes
Nov 14, 2026
Merged

robdobsn merged 3 commits into
mainfrom
fix/url-decode-escapes

Conversation

@robdobsn

Copy link
Copy Markdown
Owner

unencodeHTTPChars replaced a fixed list of printable escapes one after another, so:

  • %27 became ^ (not ')
  • %25 was decoded before the others (%2526 gave &)
  • control characters (%0D, %0A, %03), %40 and UTF-8 were not decoded

As a result, MicroPython REPL input sent with encodeURIComponent() arrived with escapes left in it.

It is now a single-pass decoder of any %XX (either hex case). A % that isn't an escape, and %00, are kept.

Also corrects the devman/setrole comment: save=1 keeps the role over a restart.

Tests: test_rest_api_params (Linux unit tests) checks the decoding and that query values are still trimmed; RestAPIEndpointManager_test.cpp covers it in the on-target unit tests.

Related: robdobsn/raftjs fix/upy-console-input-encoding.

🤖 Generated with Claude Code

robdobsn and others added 3 commits November 11, 2026 22:26
unencodeHTTPChars replaced a fixed list of printable escapes one after another, so %27
became ^ (not '), %25 was decoded before the others ("%2526" gave "&"), and control
characters (%0D, %0A, %03), %40 and UTF-8 were not decoded - MicroPython REPL input sent
with encodeURIComponent() arrived with escapes left in it. It is now a single-pass
decoder of any %XX (either hex case); a % that isn't an escape, and %00, are kept.

test_rest_api_params (Linux unit tests) checks the decoding and that query values are
still trimmed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…start

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	linux_unit_tests/Makefile
#	linux_unit_tests/README.md
@robdobsn
robdobsn merged commit 8cf0d4e into main Nov 14, 2026
1 check passed
@robdobsn
robdobsn deleted the fix/url-decode-escapes branch November 14, 2026 22:01
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.

2 participants