Commit 5c7e7eaf authored by Boris Kocherov's avatar Boris Kocherov

remove duplicate base_url composition

parent 61e2a609
......@@ -22,8 +22,14 @@
return base_url;
}
function getJSON(url) {
function getJSON(url, base_url) {
var protocol = URI(url).protocol();
if (protocol === "") {
if (base_url && !url.startsWith("/")) {
url = base_url + "/" + url;
protocol = URI(url).protocol();
}
}
if (protocol === "http" || protocol === "https") {
if (URI(window.location).protocol() !== protocol) {
throw new Error("You cannot mixed http and https calls");
......@@ -71,14 +77,7 @@
});
}
return RSVP.Queue().push(function () {
if (URI(ref).protocol() === "") {
if (base_url && !ref.startsWith("/")) {
ref = base_url + "/" + ref;
}
}
return getJSON(ref);
})
return getJSON(ref, base_url)
.push(function (external_schema) {
parts = ref.split("#");
ref = "#" + parts[1];
......@@ -227,7 +226,7 @@
.push(function (json_object) {
var parameter_schema_url,
st,
base_url;
base_url = getBaseUrl(schema_url);
for (st in json_object["software-type"]) {
if (json_object["software-type"].hasOwnProperty(st)) {
......@@ -237,14 +236,7 @@
}
}
if (URI(parameter_schema_url).protocol() === "") {
base_url = getBaseUrl(schema_url);
if (base_url !== undefined) {
parameter_schema_url = base_url + "/" + parameter_schema_url;
}
}
return getJSON(parameter_schema_url)
return getJSON(parameter_schema_url, base_url)
.push(function (schema) {
return expandSchema(schema, schema, base_url)
.push(function (loaded_json) {
......
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