Unescape HTML in URLs parsed from user input

Merge pull request #275 from mweinelt/url-unescape-html
This commit is contained in:
azlux 2021-05-16 16:30:50 +02:00 committed by GitHub
commit 1c283654fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,7 @@
# coding=utf-8
import hashlib
import html
import magic
import os
import io
@ -311,7 +312,8 @@ def get_url_from_input(string):
match = re.search("(http|https)://(\S*)?/(\S*)", string, flags=re.IGNORECASE)
if match:
url = match[1].lower() + "://" + match[2].lower() + "/" + match[3]
return url
# https://github.com/mumble-voip/mumble/issues/4999
return html.unescape(url)
else:
return ""