remove duplicate xescape(s)

This commit is contained in:
canewsin 2022-10-05 03:33:50 +05:30 committed by GitHub
parent fd857985f6
commit ac72d623f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -563,25 +563,6 @@ class UiRequest(object):
repl.update(html_chars)
return s.translate(repl)
def xescape(s):
'''combines parts from re.escape & html.escape'''
# https://github.com/python/cpython/blob/3.10/Lib/re.py#L267
# '&' is handled otherwise
re_chars = {i: '\\' + chr(i) for i in b'()[]{}*+-|^$\\.~# \t\n\r\v\f'}
# https://github.com/python/cpython/blob/3.10/Lib/html/__init__.py#L12
html_chars = {
'<' : '&lt;',
'>' : '&gt;',
'"' : '&quot;',
"'" : '&#x27;',
}
# we can't replace '&' because it makes certain zites work incorrectly
# it should however in no way interfere with re.sub in render
repl = {}
repl.update(re_chars)
repl.update(html_chars)
return s.translate(repl)
return self.render(
"src/Ui/template/wrapper.html",
server_url=server_url,