internetarchive / internetarchive/surt
surt() breaks up query incorrectly if parameter value contains (%-escaped) "&"
- Dominant language
- Python
- Stars
- 47
- Forks
- 18
- PR merge metrics
- No merged PRs in 30d
Description
```
>>> import surt
>>> url = ""http://exmaple.com/script?type=a+b+%26+c&grape=wine"
>>> surt.surt(url)
'com,exmaple)/script?+c&grape=wine&type=a+b+'
```
Desired output is `com,exmaple)/script?grape=wine&type=a+b+%26+c`
Problem is in `surt.GoogleURLCanonicalizer.minimalEscape`:
```
def minimalEscape(input):
return escapeOnce(unescapeRepeatedly(input))
```
This function turns query part of the url into `grape=wine&type=a+b+&+c`. It's clearly wrong to apply `unescapeRepeatedly` on entire query part.
I'd also question the usefulness of applying unquoting repeatedly in general. While there may be a cases where it's useful, it'd be more harmful for most of the cases.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.