Make OctoPrint.upload's url behave like others

So far only was interpreted relatively to the defined base url.
We want this to behave like other requests from the client lib
though, so now it does.
This commit is contained in:
Gina Häußge 2016-12-07 10:54:20 +01:00
parent 0de6718af3
commit 8d2681ae3f

View file

@ -222,7 +222,12 @@
var headers = OctoPrint.getRequestHeaders();
request.open("POST", OctoPrint.getBaseUrl() + url);
var urlToCall = url;
if (!_.startsWith(url, "http://") && !_.startsWith(url, "https://")) {
urlToCall = OctoPrint.getBaseUrl() + url;
}
request.open("POST", urlToCall);
_.each(headers, function(value, key) {
request.setRequestHeader(key, value);
});