URI encode IDs before replacing them in URL. Fixes #290
This commit is contained in:
parent
a7273625d7
commit
36e4fd1ef5
@ -105,7 +105,7 @@ DataTableCellUI.prototype._render = function() {
|
|||||||
.appendTo(divContent);
|
.appendTo(divContent);
|
||||||
|
|
||||||
if (service && (service.view) && (service.view.url)) {
|
if (service && (service.view) && (service.view.url)) {
|
||||||
a.attr("href", service.view.url.replace("{{id}}", match.id));
|
a.attr("href", service.view.url.replace("{{id}}", encodeURIComponent(match.id)));
|
||||||
} else if (ReconciliationManager.isFreebaseIdOrMid(r.identifierSpace)) {
|
} else if (ReconciliationManager.isFreebaseIdOrMid(r.identifierSpace)) {
|
||||||
a.attr("href", "http://www.freebase.com/view" + match.id);
|
a.attr("href", "http://www.freebase.com/view" + match.id);
|
||||||
}
|
}
|
||||||
@ -148,9 +148,8 @@ DataTableCellUI.prototype._render = function() {
|
|||||||
.text(candidate.name)
|
.text(candidate.name)
|
||||||
.appendTo(li);
|
.appendTo(li);
|
||||||
|
|
||||||
// TODO: replace view URL with local code?
|
|
||||||
if ((service) && (service.view) && (service.view.url)) {
|
if ((service) && (service.view) && (service.view.url)) {
|
||||||
a.attr("href", service.view.url.replace("{{id}}", candidate.id));
|
a.attr("href", service.view.url.replace("{{id}}", encodeURIComponent(candidate.id)));
|
||||||
} else if (ReconciliationManager.isFreebaseIdOrMid(r.identifierSpace)) {
|
} else if (ReconciliationManager.isFreebaseIdOrMid(r.identifierSpace)) {
|
||||||
a.attr("href", "http://www.freebase.com/view" + candidate.id);
|
a.attr("href", "http://www.freebase.com/view" + candidate.id);
|
||||||
}
|
}
|
||||||
@ -454,14 +453,14 @@ DataTableCellUI.prototype._previewCandidateTopic = function(candidate, elmt, pre
|
|||||||
.html(DOM.loadHTML("core", "scripts/views/data-table/cell-recon-preview-popup-header.html"));
|
.html(DOM.loadHTML("core", "scripts/views/data-table/cell-recon-preview-popup-header.html"));
|
||||||
|
|
||||||
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 = preview.srch.replace("{{id}}", id);
|
var url = preview.srch.replace("{{id}}", encodeURIComponent(id));
|
||||||
var iframe = $('<iframe></iframe>')
|
var iframe = $('<iframe></iframe>')
|
||||||
.width(preview.width)
|
.width(preview.width)
|
||||||
.height(preview.height)
|
.height(preview.height)
|
||||||
.attr("src", url)
|
.attr("src", url)
|
||||||
.appendTo(fakeMenu);
|
.appendTo(fakeMenu);
|
||||||
} else { // Otherwise use our internal preview
|
} else { // Otherwise use our internal preview
|
||||||
var url = DataTableCellUI.internalPreview.srchurl.replace("\${id}",id);
|
var url = DataTableCellUI.internalPreview.srchurl.replace("\${id}",encodeURIComponent(id));
|
||||||
$.ajax(url,{dataType:"jsonp"}).done(function(searchResponse) {
|
$.ajax(url,{dataType:"jsonp"}).done(function(searchResponse) {
|
||||||
var data = searchResponse.result[0];
|
var data = searchResponse.result[0];
|
||||||
var html = $.suggest.suggest.create_flyout(data, preview.imgurl);
|
var html = $.suggest.suggest.create_flyout(data, preview.imgurl);
|
||||||
|
Loading…
Reference in New Issue
Block a user