mirror of
https://github.com/discourse/discourse.git
synced 2025-02-24 20:43:28 +08:00
SECURITY: Escape image title in lightbox.
This commit is contained in:
parent
6d2a687ec7
commit
515024a0ac
@ -1,4 +1,5 @@
|
||||
import loadScript from 'discourse/lib/load-script';
|
||||
import { escapeExpression } from 'discourse/lib/utilities';
|
||||
|
||||
export default function($elem) {
|
||||
$("a.lightbox", $elem).each(function(i, e) {
|
||||
@ -33,7 +34,7 @@ export default function($elem) {
|
||||
image: {
|
||||
titleSrc(item) {
|
||||
const href = item.el.data("download-href") || item.src;
|
||||
let src = [item.el.attr("title"), $("span.informations", item.el).text().replace('x', '×')];
|
||||
let src = [escapeExpression(item.el.attr("title")), $("span.informations", item.el).text().replace('x', '×')];
|
||||
if (!Discourse.SiteSettings.prevent_anons_from_downloading_files || Discourse.User.current()) {
|
||||
src.push('<a class="image-source-link" href="' + href + '">' + I18n.t("lightbox.download") + '</a>');
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user