Permalink
Browse files

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.
  • Loading branch information...
1 parent 0de6718 commit 8d2681ae3fdd126aa34e105ba61aaa82f9c158c0 @foosel committed Dec 7, 2016
Showing with 6 additions and 1 deletion.
  1. +6 −1 src/octoprint/static/js/app/client/base.js
@@ -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);
});

0 comments on commit 8d2681a

Please sign in to comment.