Ensure httpNodePath is handled properly in HTTP/WS nodes

Cope with httpNodePath not ending with a / when it comes to
displaying the node details. The runtime is not affected.
This commit is contained in:
Nick O'Leary 2014-10-08 11:03:18 +01:00
parent da4446c20f
commit 21e349c22a
2 changed files with 26 additions and 6 deletions

View File

@ -156,8 +156,15 @@
if (this.name) {
return this.name;
} else if (this.url) {
var root = RED.settings.httpNodeRoot.slice(0,-1);
root += this.url;
var root = RED.settings.httpNodeRoot;
if (root.slice(-1) != "/") {
root = root+"/";
}
if (this.url.charAt(0) == "/") {
root += this.url.slice(1);
} else {
root += this.url;
}
return "["+this.method+"] "+root;
} else {
return "http";
@ -167,7 +174,10 @@
return this.name?"node_label_italic":"";
},
oneditprepare: function() {
var root = RED.settings.httpNodeRoot.slice(0,-1);
var root = RED.settings.httpNodeRoot;
if (root.slice(-1) == "/") {
root = root.slice(0,-1);
}
if (root == "") {
$("#node-input-tip").hide();
} else {

View File

@ -135,12 +135,22 @@
inputs:0,
outputs:0,
label: function() {
var root = RED.settings.httpNodeRoot.slice(0,-1);
root += this.path;
var root = RED.settings.httpNodeRoot;
if (root.slice(-1) != "/") {
root = root+"/";
}
if (this.path.charAt(0) == "/") {
root += this.path.slice(1);
} else {
root += this.path;
}
return root;
},
oneditprepare: function() {
var root = RED.settings.httpNodeRoot.slice(0,-1);
var root = RED.settings.httpNodeRoot;
if (root.slice(-1) == "/") {
root = root.slice(0,-1);
}
if (root == "") {
$("#node-config-ws-tip").hide();
} else {