Fix URL encoding - fixes #1059

Fixes both permalink & "browse this cluster".
Substitutes encodeURIComponent for escape
This commit is contained in:
Tom Morris 2015-10-16 15:21:21 -04:00
parent 4834deca5e
commit c74fce0180
5 changed files with 9 additions and 23 deletions

View File

@ -196,8 +196,8 @@ ClusteringDialog.prototype._renderTable = function(clusters) {
}
var params = [
"project=" + escape(theProject.id),
"ui=" + escape(JSON.stringify({
"project=" + encodeURIComponent(theProject.id),
"ui=" + encodeURIComponent(JSON.stringify({
"facets" : [ facet ]
}))
];

View File

@ -229,7 +229,7 @@ Refine.OpenProjectUI.prototype._onClickUploadFileButton = function(evt) {
} else {
$("#file-upload-form").attr("action",
"command/core/create-project-from-upload?" + [
"url=" + escape(dataURL),
"url=" + encodeURICompnent(dataURL),
"split-into-columns=" + $("#split-into-columns-input")[0].checked,
"separator=" + $("#separator-input")[0].value,
"ignore=" + $("#ignore-input")[0].value,

View File

@ -62,8 +62,6 @@ Refine.reportException = function(e) {
};
function resize() {
var header = $("#header");
var leftPanelWidth = 300;
var width = $(window).width();
var top = $("#header").outerHeight();
@ -457,8 +455,8 @@ Refine.fetchRows = function(start, limit, onDone, sorting) {
Refine.getPermanentLink = function() {
var params = [
"project=" + escape(theProject.id),
"ui=" + escape(JSON.stringify({
"project=" + encodeURIComponent(theProject.id),
"ui=" + encodeURIComponent(JSON.stringify({
facets: ui.browsingEngine.getFacetUIStates()
}))
];
@ -475,7 +473,7 @@ function onLoad() {
var uiState = {};
if ("ui" in params) {
try {
uiState = JSON.parse(params.ui);
uiState = JSON.parse(decodeURIComponent(params.ui));
} catch (e) {
}
}

View File

@ -257,7 +257,7 @@ ReconDialog.prototype._onAddNamespacedService = function() {
var typeData = elmts.typeInput.data("data.suggest");
if (namespaceData) {
var url = "http://reconcile.freebaseapps.com/namespace_reconcile?namespace="
+ escape(namespaceData.id);
+ encodeURIComponent(namespaceData.id);
if (typeData) {
url += "&type=" + typeData.id;
}

View File

@ -82,7 +82,7 @@ URL.getParameters = function() {
params = params.substr(1).split("&");
$.each(params, function() {
pair = this.split("=");
r[pair[0]] = unescape(pair[1]);
r[pair[0]] = decodeURIComponent(pair[1]);
});
}
@ -102,15 +102,3 @@ URL.looksLikeUrl = function(s) {
return false;
};
URL.getHostname = function(){
var url = location.href; // entire url including querystring - also: window.location.href;
var baseURL = url.substring(0, url.indexOf('/',7));//7 is the length of http://
return baseURL;
};
URL.urlify = function(str) {
if(!str) {
return '';
}
return escape(str.replace(/\W/g, '_'));
};