Make sure project ID is completely numeric. Slightly better error reporting on project page when project ID is not valid.
git-svn-id: http://google-refine.googlecode.com/svn/trunk@2441 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
4fbfd17ddf
commit
e21ae32722
@ -50,9 +50,15 @@ public class GetProjectMetadataCommand extends Command {
|
|||||||
public void doGet(HttpServletRequest request, HttpServletResponse response)
|
public void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||||
throws ServletException, IOException {
|
throws ServletException, IOException {
|
||||||
|
|
||||||
Project project = getProject(request);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
Project project;
|
||||||
|
try {
|
||||||
|
project = getProject(request);
|
||||||
|
} catch (ServletException e) {
|
||||||
|
respond(response, "error", e.getLocalizedMessage());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
respondJSON(response, ProjectManager.singleton.getProjectMetadata(project.id));
|
respondJSON(response, ProjectManager.singleton.getProjectMetadata(project.id));
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
respondException(response, e);
|
respondException(response, e);
|
||||||
|
@ -571,7 +571,9 @@ function process(path, request, response) {
|
|||||||
params.put(name, request.getParameterValues(name)[0]);
|
params.put(name, request.getParameterValues(name)[0]);
|
||||||
}
|
}
|
||||||
context.params = params;
|
context.params = params;
|
||||||
context.projectID = request.getParameter("project");
|
|
||||||
|
// We prepend '' to convert the Java string to a Javascript string.
|
||||||
|
context.projectID = ('' + request.getParameter("project")).replace(/\D/g, '');
|
||||||
|
|
||||||
var styles = ClientSideResourceManager.getPaths(lastSegment + "/styles");
|
var styles = ClientSideResourceManager.getPaths(lastSegment + "/styles");
|
||||||
var styleInjection = [];
|
var styleInjection = [];
|
||||||
|
@ -153,12 +153,18 @@ Refine.setTitle = function(status) {
|
|||||||
$("#project-name-button").text(theProject.metadata.name);
|
$("#project-name-button").text(theProject.metadata.name);
|
||||||
};
|
};
|
||||||
|
|
||||||
Refine.reinitializeProjectData = function(f) {
|
Refine.reinitializeProjectData = function(f, fError) {
|
||||||
Ajax.chainGetJSON(
|
$.getJSON(
|
||||||
"/command/core/get-project-metadata?" + $.param({ project: theProject.id }), null,
|
"/command/core/get-project-metadata?" + $.param({ project: theProject.id }), null,
|
||||||
function(data) {
|
function(data) {
|
||||||
|
if (data.status == 'error') {
|
||||||
|
alert(data.message);
|
||||||
|
if (fError) {
|
||||||
|
fError();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
theProject.metadata = data;
|
theProject.metadata = data;
|
||||||
},
|
$.getJSON(
|
||||||
"/command/core/get-models?" + $.param({ project: theProject.id }), null,
|
"/command/core/get-models?" + $.param({ project: theProject.id }), null,
|
||||||
function(data) {
|
function(data) {
|
||||||
for (var n in data) {
|
for (var n in data) {
|
||||||
@ -166,8 +172,13 @@ Refine.reinitializeProjectData = function(f) {
|
|||||||
theProject[n] = data[n];
|
theProject[n] = data[n];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
f();
|
||||||
},
|
},
|
||||||
f
|
'json'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
'json'
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -442,9 +453,14 @@ function onLoad() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Refine.reinitializeProjectData(function() {
|
Refine.reinitializeProjectData(
|
||||||
|
function() {
|
||||||
initializeUI(uiState);
|
initializeUI(uiState);
|
||||||
});
|
},
|
||||||
|
function() {
|
||||||
|
$("#loading-message").hide();
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user