mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-10-15 01:13:20 +02:00
`build_regex()` escaped literal runs verbatim and `expand_uri_template()`
copied them through unchanged, but the URI on the other side does not stay
verbatim: it reaches the server as an `AnyUrl`, which percent-encodes it.
So a resource template whose literal text carries a non-ASCII character or a
space was listed and then unreadable: the pattern held `café` while the
incoming URI read `caf%C3%A9`. The raw form failed too, since the
normalization happens before matching.
RFC 6570 §3.1 is the rule the expansion side was missing: a literal outside
the reserved/unreserved sets is percent-encoded as UTF-8 when the template is
expanded, which is exactly the form `AnyUrl` produces. Encode literals in both
directions, passing existing `%XX` triplets through so an already-encoded
literal is not encoded twice.
🤖 Generated with Claude Code
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
|
||
|---|---|---|
| .. | ||
| __init__.py | ||
| test_file_resources.py | ||
| test_function_resources.py | ||
| test_resource_security.py | ||
| test_resource_template.py | ||
| test_resource_template_meta.py | ||
| test_resource_template_query_params.py | ||
| test_resources.py | ||
| test_standalone_decorator.py | ||