Merge pull request #1579 from matrix-org/luke/fix-img-no-src-bug

Ignore img tags in HTML if src is not specified
This commit is contained in:
Matthew Hodgson 2017-11-06 18:02:38 +00:00 committed by GitHub
commit 17ae37bd3b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -208,7 +208,7 @@ const sanitizeHtmlParams = {
// Strip out imgs that aren't `mxc` here instead of using allowedSchemesByTag
// because transformTags is used _before_ we filter by allowedSchemesByTag and
// we don't want to allow images with `https?` `src`s.
if (!attribs.src.startsWith('mxc://')) {
if (!attribs.src || !attribs.src.startsWith('mxc://')) {
return { tagName, attribs: {}};
}
attribs.src = MatrixClientPeg.get().mxcUrlToHttp(