Unescape HTML in URLs parsed from user input
Merge pull request #275 from mweinelt/url-unescape-html
This commit is contained in:
commit
1c283654fd
4
util.py
4
util.py
@ -2,6 +2,7 @@
|
|||||||
# coding=utf-8
|
# coding=utf-8
|
||||||
|
|
||||||
import hashlib
|
import hashlib
|
||||||
|
import html
|
||||||
import magic
|
import magic
|
||||||
import os
|
import os
|
||||||
import io
|
import io
|
||||||
@ -311,7 +312,8 @@ def get_url_from_input(string):
|
|||||||
match = re.search("(http|https)://(\S*)?/(\S*)", string, flags=re.IGNORECASE)
|
match = re.search("(http|https)://(\S*)?/(\S*)", string, flags=re.IGNORECASE)
|
||||||
if match:
|
if match:
|
||||||
url = match[1].lower() + "://" + match[2].lower() + "/" + match[3]
|
url = match[1].lower() + "://" + match[2].lower() + "/" + match[3]
|
||||||
return url
|
# https://github.com/mumble-voip/mumble/issues/4999
|
||||||
|
return html.unescape(url)
|
||||||
else:
|
else:
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user