Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass the Request.decode errors argument down to transcode_query #438

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/webob/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -1749,7 +1749,7 @@ def transcode_query(self, q):

return q_orig

q = list(parse_qsl_text(q, self.charset))
q = list(parse_qsl_text(q, self.charset, self.errors))

return url_encode(q)

Expand Down
4 changes: 2 additions & 2 deletions src/webob/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def url_unquote(s):
return unquote(s.encode("ascii")).decode("latin-1")


def parse_qsl_text(qs, encoding="utf-8"):
def parse_qsl_text(qs, encoding="utf-8", errors="strict"):
qs = qs.encode("latin-1")
qs = qs.replace(b"+", b" ")
pairs = [s2 for s1 in qs.split(b"&") for s2 in s1.split(b";") if s2]
Expand All @@ -34,7 +34,7 @@ def parse_qsl_text(qs, encoding="utf-8"):
nv.append("")
name = unquote(nv[0])
value = unquote(nv[1])
yield (name.decode(encoding), value.decode(encoding))
yield (name.decode(encoding, errors), value.decode(encoding, errors))


def text_(s, encoding="latin-1", errors="strict"):
Expand Down