Unverified Commit 6f939f64 authored by Evan W. Patton's avatar Evan W. Patton Committed by Jeffrey I. Schiller

Attempt HTTPS version of URL if HTTP redirect fails due to lack of CORS

Change-Id: I32f1bba6e7f1db17321665612a8ff2c2236446fb
parent 1ef81e50
......@@ -656,7 +656,7 @@ public class TemplateUploadWizard extends Wizard implements NewUrlDialogCallback
* @param url A string of the form "http://... .asc
* @param onSuccessCommand
*/
private static void openTemplateProject(String url, final NewProjectCommand onSuccessCommand) {
private static void openTemplateProject(final String url, final NewProjectCommand onSuccessCommand) {
final Ode ode = Ode.getInstance();
// This Async callback is called after the project is input and created
......@@ -705,7 +705,11 @@ public class TemplateUploadWizard extends Wizard implements NewUrlDialogCallback
public void onResponseReceived(Request request, Response response) {
// The response.getText is the zip data used to create a new project.
// The callback opens the project
ode.getProjectService().newProjectFromExternalTemplate(projectName,response.getText(),callback);
if (response != null && response.getStatusCode() == 200 && response.getText() != null && !response.getText().isEmpty()) {
ode.getProjectService().newProjectFromExternalTemplate(projectName, response.getText(), callback);
} else if (url.startsWith("http:")) {
openTemplateProject(url.replaceFirst("http:", "https:"), onSuccessCommand);
}
}
});
} catch (RequestException e) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment