1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

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

View File

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