Skip to content

Commit 485cfdb

Browse files
authored
Merge branch 'dev' into 1209-bug-fix-document-type-creator-form
2 parents b680ab9 + 3388dea commit 485cfdb

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,9 @@ For each PR made, an entry should be added to this changelog. It should contain
107107
- Added universal search functionality tests
108108
- Created search pane filter tests
109109
- Added pattern application form tests with validation checks
110+
111+
- 1101-bug-fix-quotes-not-escaped-in-titles
112+
- Description: Title rules that include single quotes show up correctly in the sinequa frontend (and the COSMOS api) but not in the delta urls page.
113+
- Changes:
114+
- Added `escapeHtml` function in the `delta_url_list.js` file to handle special character escaping correctly.
115+
- Called this function while retrieving the titles in `getGeneratedTitleColumn()` and `getCuratedGeneratedTitleColumn()` functions.

sde_indexing_helper/static/js/delta_url_list.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1208,12 +1208,22 @@ function getCuratedScrapedTitleColumn() {
12081208
};
12091209
}
12101210

1211+
function escapeHtml(str) {
1212+
if (!str) return '';
1213+
return str
1214+
.replace(/&/g, '&')
1215+
.replace(/</g, '&lt;')
1216+
.replace(/>/g, '&gt;')
1217+
.replace(/"/g, '&quot;')
1218+
.replace(/'/g, '&#39;');
1219+
}
1220+
12111221
function getGeneratedTitleColumn() {
12121222
return {
12131223
data: "generated_title",
12141224
width: "20%",
12151225
render: function (data, type, row) {
1216-
return `<input type="text" class="form-control individual_title_input whiteText" value='${data}' data-generated-title-id=${row["generated_title_id"]
1226+
return `<input type="text" class="form-control individual_title_input whiteText" value="${escapeHtml(data)}" data-generated-title-id=${row["generated_title_id"]
12171227
} data-match-pattern-type=${row["match_pattern_type"]
12181228
} data-delta-urls-count=${row["delta_urls_count"]
12191229
} data-url=${remove_protocol(row["url"])} />`;
@@ -1226,7 +1236,7 @@ function getCuratedGeneratedTitleColumn() {
12261236
data: "generated_title",
12271237
width: "20%",
12281238
render: function (data, type, row) {
1229-
return `<input type="text" class="form-control individual_title_input whiteText" value='${data}' data-generated-title-id=${row["generated_title_id"]
1239+
return `<input type="text" class="form-control individual_title_input whiteText" value="${escapeHtml(data)}" data-generated-title-id=${row["generated_title_id"]
12301240
} data-match-pattern-type=${row["match_pattern_type"]
12311241
} data-curated-urls-count=${row["curated_urls_count"]
12321242
} data-url=${remove_protocol(row["url"])} />`;

0 commit comments

Comments
 (0)