Mercurial > prosody-modules
comparison mod_xhtmlim/mod_xhtmlim.lua @ 2866:276f7af8afd1
mod_xhtmlim: Fix scheme check (thanks wiktor)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 30 Jan 2018 20:04:55 +0100 |
parents | f6ed4421167d |
children | 6444fb5dbb51 |
comparison
equal
deleted
inserted
replaced
2865:f6ed4421167d | 2866:276f7af8afd1 |
---|---|
79 -- module:log("debug", "Removing disallowed attribute %q from <%s>", attr, tag.name); | 79 -- module:log("debug", "Removing disallowed attribute %q from <%s>", attr, tag.name); |
80 tag.attr[attr] = nil; | 80 tag.attr[attr] = nil; |
81 elseif attr == "src" or attr == "href" then | 81 elseif attr == "src" or attr == "href" then |
82 local urlattr = url.parse(value); | 82 local urlattr = url.parse(value); |
83 local scheme = urlattr and urlattr.scheme; | 83 local scheme = urlattr and urlattr.scheme; |
84 if scheme ~= "http" and scheme ~= "https" and scheme ~= "mailto" and scheme == "xmpp" and scheme ~= "cid" then | 84 if scheme ~= "http" and scheme ~= "https" and scheme ~= "mailto" and scheme ~= "xmpp" and scheme ~= "cid" then |
85 tag.attr[attr] = "https://url.was.invalid/"; | 85 tag.attr[attr] = "https://url.was.invalid/"; |
86 end | 86 end |
87 end | 87 end |
88 end | 88 end |
89 else | 89 else |