Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,9 @@ For each PR made, an entry should be added to this changelog. It should contain
- Added universal search functionality tests
- Created search pane filter tests
- Added pattern application form tests with validation checks

- 1101-bug-fix-quotes-not-escaped-in-titles
- 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.
- Changes:
- Added `escapeHtml` function in the `delta_url_list.js` file to handle special character escaping correctly.
- Called this function while retrieving the titles in `getGeneratedTitleColumn()` and `getCuratedGeneratedTitleColumn()` functions.
14 changes: 12 additions & 2 deletions sde_indexing_helper/static/js/delta_url_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -1208,12 +1208,22 @@ function getCuratedScrapedTitleColumn() {
};
}

function escapeHtml(str) {
if (!str) return '';
return str
.replace(/&/g, '&')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/"/g, '&quot;')
.replace(/'/g, '&#39;');
}

function getGeneratedTitleColumn() {
return {
data: "generated_title",
width: "20%",
render: function (data, type, row) {
return `<input type="text" class="form-control individual_title_input whiteText" value='${data}' data-generated-title-id=${row["generated_title_id"]
return `<input type="text" class="form-control individual_title_input whiteText" value="${escapeHtml(data)}" data-generated-title-id=${row["generated_title_id"]
} data-match-pattern-type=${row["match_pattern_type"]
} data-delta-urls-count=${row["delta_urls_count"]
} data-url=${remove_protocol(row["url"])} />`;
Expand All @@ -1226,7 +1236,7 @@ function getCuratedGeneratedTitleColumn() {
data: "generated_title",
width: "20%",
render: function (data, type, row) {
return `<input type="text" class="form-control individual_title_input whiteText" value='${data}' data-generated-title-id=${row["generated_title_id"]
return `<input type="text" class="form-control individual_title_input whiteText" value="${escapeHtml(data)}" data-generated-title-id=${row["generated_title_id"]
} data-match-pattern-type=${row["match_pattern_type"]
} data-curated-urls-count=${row["curated_urls_count"]
} data-url=${remove_protocol(row["url"])} />`;
Expand Down