fast-query-parsers
fast-query-parsers copied to clipboard
Bug: Incorrect parsing of percent encoded strings
Description
So basically when i am executing the following code, it results in
[('info_hash=%0dA%f0%1d%f5R%ba%a3%e0%c0t%bb%87b%0b%82%87%fd%89n', ''), ('peer_id', '-qB5030-!k5xcyS5Fny8'), ('port', '27442'), ('uploaded', '0'), ('downloaded', '0'), ('left', '0'), ('corrupt', '0'), ('key', '6F7CD0CB'), ('event', 'started'), ('numwant', '200'), ('compact', '1'), ('no_peer_id', '1'), ('supportcrypto', '1'), ('redundant', '0')]
but it should be:
[('info_hash', '%0dA%f0%1d%f5R%ba%a3%e0%c0t%bb%87b%0b%82%87%fd%89n'), ('peer_id', '-qB5030-!k5xcyS5Fny8'), ('port', '27442'), ('uploaded', '0'), ('downloaded', '0'), ('left', '0'), ('corrupt', '0'), ('key', '6F7CD0CB'), ('event', 'started'), ('numwant', '200'), ('compact', '1'), ('no_peer_id', '1'), ('supportcrypto', '1'), ('redundant', '0')]
URL to code causing the issue
No response
MCVE
from fast_query_parsers import parse_query_string
# The encoded string
encoded_string = b"info_hash=%0dA%f0%1d%f5R%ba%a3%e0%c0t%bb%87b%0b%82%87%fd%89n&peer_id=-qB5030-!k5xcyS5Fny8&port=27442&uploaded=0&downloaded=0&left=0&corrupt=0&key=6F7CD0CB&event=started&numwant=200&compact=1&no_peer_id=1&supportcrypto=1&redundant=0"
# Extract the 'info_hash' value
info_hash_encoded = parse_query_string(encoded_string,'&')
# Print the result
print(info_hash_encoded)
Steps to reproduce
No response
Screenshots
Logs
No response
Package Version
1.0.3
Platform
- [ ] Linux
- [ ] Mac
- [X] Windows
- [ ] Other (Please specify in the description above)