fix not only alphanumeric characters domain name

This commit is contained in:
Kayou 2021-11-15 00:49:51 +01:00 committed by GitHub
parent 6e4c1facaf
commit 0e6369bb38
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1070,7 +1070,7 @@ function redirect(url)
if not string.starts(url, "/") and not string.starts(url, "http://") and not string.starts(url, "https://") then
url = "https://"..url
end
local domain = url:match("^https?://([%w%.]*)/?")
local domain = url:match("^https?://([^/]+)/?")
if string.match(url, "(.*)\n") or (domain ~= nil and not is_in_table(conf["domains"], domain)) then
logger.debug("Unauthorized redirection to "..url)
flash("fail", t("redirection_error_invalid_url"))