guard against markdown images with double-quotes in their href

pull/1/head
ansuz 4 years ago
parent 433470cf40
commit 6ddcbb948e

@ -267,7 +267,7 @@ define([
}; };
renderer.image = function (href, title, text) { renderer.image = function (href, title, text) {
if (href.slice(0,6) === '/file/') { if (href.slice(0,6) === '/file/') { // XXX this has been deprecated for about 3 years... use the same inline image handler as below?
// DEPRECATED // DEPRECATED
// Mediatag using markdown syntax should not be used anymore so they don't support // Mediatag using markdown syntax should not be used anymore so they don't support
// password-protected files // password-protected files
@ -283,12 +283,14 @@ define([
mt += '</media-tag>'; mt += '</media-tag>';
return mt; return mt;
} }
var out = '<img src="' + href + '" alt="' + text + '"';
if (title) { var img = h('img.cp-inline-img', {
out += ' title="' + title + '"'; src: href || '',
} title: title || '',
out += this.options.xhtml ? '/>' : '>'; alt: text || '',
return out; });
return img.outerHTML;
}; };
restrictedRenderer.image = renderer.image; restrictedRenderer.image = renderer.image;

Loading…
Cancel
Save