Skip to content

Commit

Permalink
http.unshortenUrl recognizes subdomains of http.shortenerHosts
Browse files Browse the repository at this point in the history
  • Loading branch information
knu committed Feb 3, 2023
1 parent 3372dfa commit 326bd4f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion http.lua
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,16 @@ http.unshortenUrl = function(url)
return purl, "host is missing"
end
local host = uri.host:lower()
if fnutils.indexOf(http.shortenerHosts, host) == nil then
local isShortener = false
for _, domain in ipairs(http.shortenerHosts) do
logger = hs.logger.new("unshorten", "info")
logger.i(host, domain, "." .. domain)
if host == domain or utils.string.endsWith(host, "." .. domain) then
isShortener = true
break
end
end
if not isShortener then
return nurl, nil
end
if count >= 3 then
Expand Down

0 comments on commit 326bd4f

Please # to comment.