Revert "Fix bug with percentage redirects, close #1650"

This reverts commit c85d669de3.

Refs #1658
pull/1656/head
Simon Willison 2022-03-15 08:37:31 -07:00
rodzic 5a353a32b9
commit 77e718c3ff
2 zmienionych plików z 1 dodań i 10 usunięć

Wyświetl plik

@ -10,7 +10,6 @@ import markupsafe
import mergedeep
import os
import re
import secrets
import shlex
import tempfile
import typing
@ -1173,8 +1172,4 @@ def dash_encode(s: str) -> str:
@documented
def dash_decode(s: str) -> str:
"Decodes a dash-encoded string, so ``-2Ffoo-2Fbar`` -> ``/foo/bar``"
# Avoid accidentally decoding a %2f style sequence
temp = secrets.token_hex(16)
s = s.replace("%", temp)
decoded = urllib.parse.unquote(s.replace("-", "%"))
return decoded.replace(temp, "%")
return urllib.parse.unquote(s.replace("-", "%"))

Wyświetl plik

@ -961,10 +961,6 @@ def test_no_alternate_url_json(app_client, path):
"/fivethirtyeight/twitter-ratio%2Fsenators",
"/fivethirtyeight/twitter-2Dratio-2Fsenators",
),
(
"/fixtures/table%2Fwith%2Fslashes",
"/fixtures/table-2Fwith-2Fslashes",
),
# query string should be preserved
("/foo/bar%2Fbaz?id=5", "/foo/bar-2Fbaz?id=5"),
),