Skip to content

Commit 0c60a69

Browse files
committed
fix(keywords): syntax error on escape double quotes on keyword name
1 parent f9a5717 commit 0c60a69

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

cds/modules/records/static/templates/cds_records/keywords.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ <h3 class="cds-title-section-decoration bt bw-1 pt-10 mb-20"><i class="fa fa-tag
66
<div class="cds-tags cds-keywords">
77
<ul>
88
<li ng-repeat="keyword in record.metadata.keywords">
9-
<a ng-href='/search?q=keywords.name:"{{ keyword.name.replace(/"/g, '\\"') }}"'>{{ keyword.name }}</a>
9+
<a ng-href='/search?q=keywords.name:"{{ keyword.name | escapeDoubleQuotes }}"'>{{ keyword.name }}</a>
1010
</li>
1111
</ul>
1212
</div>

cds/modules/theme/assets/bootstrap3/js/cds/module.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -809,6 +809,13 @@ app.filter("assembleShareURL", [
809809
},
810810
]);
811811

812+
// Escape double quotes filter
813+
app.filter("escapeDoubleQuotes", function () {
814+
return function (text) {
815+
return text ? text.replace(/"/g, '\\"') : text;
816+
};
817+
});
818+
812819

813820
angular.module("cds").directive("bootstrapInvenioSearch", function () {
814821
return {

0 commit comments

Comments
 (0)