Opened 6 years ago
Closed 6 years ago
#30551 closed Bug (wontfix)
urlize on URL with incomplete query string adds equal sign.
| Reported by: | Jochen Garcke | Owned by: | nobody |
|---|---|---|---|
| Component: | Utilities | Version: | dev |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
If one uses urlize in a template {{ work_urls|urlize }} on URLs such as
http://www.isfdb.org/cgi-bin/pl.cgi?284309
an equal sign will be added
http://www.isfdb.org/cgi-bin/pl.cgi?284309=
The resulting URL fails at that site.
Granted, I suspect that this is likely not a standard conform use of '?' by that site, but still unwanted behaviour.
Change History (2)
comment:1 by , 6 years ago
| Component: | Uncategorized → Utilities |
|---|---|
| Summary: | urlize on URL with incomplete query string adds equal sign → urlize on URL with incomplete query string adds equal sign. |
| Version: | 1.11 → master |
comment:2 by , 6 years ago
| Resolution: | → wontfix |
|---|---|
| Status: | new → closed |
| Type: | Uncategorized → Bug |
It seems that a patch is not feasible with the current implementation that uses parse_qsl(), because
>>> parse_qsl('a', keep_blank_values=True)
[('a', '')]
>>> parse_qsl('a=', keep_blank_values=True)
[('a', '')]
so would have to add a special workaround for this single case, what is not worth it.
Thanks for the report. smart_urlquote() adds a trailing equal sign. I noticed that
parse_qsl()raises:File "/usr/lib/python3.6/urllib/parse.py", line 693, in parse_qsl raise ValueError("bad query field: %r" % (name_value,)) ValueError: bad query field: '284309'when we add
strict_parsing=Trueflag, hence I believe that query string used by this site is incorrect. I'm not sure that we should handle this case in Django.