Skip to content

Fix prefix slicing on numbers and quoting in reserved expansion - #165

Open
Fire162 wants to merge 1 commit into
python-hyper:mainfrom
Fire162:fix-prefix-and-reserved-expansion
Open

Fire162 wants to merge 1 commit into
python-hyper:mainfrom
Fire162:fix-prefix-and-reserved-expansion

Conversation

@Fire162

@Fire162 Fire162 commented Oct 24, 2026

Copy link
Copy Markdown

Closes #163

Prefix modifiers caused a TypeError when values were integers or floats because value[:prefix] expected subscriptable objects. Converting the value to string first before slicing allows prefix modifiers to work on numeric values.

In reserved expansions, _only_quote_unquoted_characters skipped quoting entirely if the string already contained any percent-encoded characters, leaving characters like spaces unencoded. Splitting on valid percent-encoded triplets allows preserving existing escapes while encoding remaining unescaped characters.

Convert values to string before applying prefix slicing so numeric and non-string values can be sliced with prefix modifiers without raising TypeError.

In reserved expansion, split on existing percent-encoded triplets so unescaped characters are quoted without double-encoding existing percent escapes.

This branch has not been deployed

No deployments
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.

Prefix modifier crashes on non-string values; reserved expansion stops encoding once the value contains a percent-escape

1 participant