Skip to content

Commit

Permalink
Merge pull request #1252 from plone/pat-structure-escape-html
Browse files Browse the repository at this point in the history
Fix escaped HTML in crumb and rename title
  • Loading branch information
petschki committed Dec 7, 2022
2 parents 0b3d7ac + 88ec616 commit 0d0020f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/pat/structure/js/views/generic-popover.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import _ from "underscore";
import _t from "../../../../core/i18n-wrapper";
import PopoverView from "../../../../core/ui/views/popover";
import registry from "@patternslib/patternslib/src/core/registry";
import utils from "@patternslib/patternslib/src/core/utils";

export default PopoverView.extend({
events: {
Expand Down Expand Up @@ -45,7 +46,9 @@ export default PopoverView.extend({
getTemplateOptions: function () {
const items = [];
for (const item of this.app.selectedCollection.models) {
items.push(item.toJSON());
let _json = item.toJSON();
_json["Title"] = utils.escape_html(_json["Title"]);
items.push(_json);
}
return $.extend({}, true, this.options, {
items: items,
Expand Down
3 changes: 2 additions & 1 deletion src/pat/structure/js/views/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import "../../../datatables/datatables";
import "bootstrap/js/src/alert";
import utils from "../../../../core/utils";
import logging from "@patternslib/patternslib/src/core/logging";
import patternslib_utils from "@patternslib/patternslib/src/core/utils";

const log = logging.getLogger("pat-structure/table");

Expand Down Expand Up @@ -66,7 +67,7 @@ export default BaseView.extend({
if (crumbs && crumbs.length) {
const $crumbs = this.$(".fc-breadcrumbs a.crumb");
_.each(crumbs, (crumb, idx) => {
$crumbs.eq(idx).html(crumb.title);
$crumbs.eq(idx).html(patternslib_utils.escape_html(crumb.title));
});
}
this.trigger("context-info:set");
Expand Down

0 comments on commit 0d0020f

Please sign in to comment.