Fixes #3730. IDs / URIs should be encoded with a method that encodes special characters like # (#3731)

This commit is contained in:
Matthieu Jonglez 2021-10-19 14:47:10 +01:00 committed by GitHub
parent 7e9210c87d
commit aa1b61769c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -149,7 +149,7 @@ DataTableCellUI.prototype._render = function() {
.appendTo(divContentRecon); .appendTo(divContentRecon);
if (service && (service.view) && (service.view.url)) { if (service && (service.view) && (service.view.url)) {
a.attr("href", encodeURI(service.view.url.replace("{{id}}", match.id))); a.attr("href", service.view.url.replace("{{id}}", encodeURIComponent(match.id)));
} }
if (DataTableCellUI.previewMatchedCells) { if (DataTableCellUI.previewMatchedCells) {
@ -196,7 +196,7 @@ DataTableCellUI.prototype._render = function() {
.appendTo(liSpan); .appendTo(liSpan);
if ((service) && (service.view) && (service.view.url)) { if ((service) && (service.view) && (service.view.url)) {
a.attr("href", encodeURI(service.view.url.replace("{{id}}", candidate.id))); a.attr("href", service.view.url.replace("{{id}}", encodeURIComponent(candidate.id)));
} }
self._previewOnHover(service, candidate, liSpan.parent(), liSpan, true); self._previewOnHover(service, candidate, liSpan.parent(), liSpan, true);
@ -485,7 +485,7 @@ DataTableCellUI.prototype._previewCandidateTopic = function(candidate, elmt, pre
} }
if (preview && preview.url) { // Service has a preview URL associated with it if (preview && preview.url) { // Service has a preview URL associated with it
var url = encodeURI(preview.url.replace("{{id}}", id)); var url = preview.url.replace("{{id}}", encodeURIComponent(id));
var iframe = $('<iframe></iframe>') var iframe = $('<iframe></iframe>')
.width(preview.width) .width(preview.width)
.height(preview.height) .height(preview.height)