addad missing option to set directory in incoming message for WebDAV list
This commit is contained in:
12
nextcloud.js
12
nextcloud.js
@ -134,11 +134,14 @@ module.exports = function(RED) {
|
|||||||
node.on('input', function(msg) {
|
node.on('input', function(msg) {
|
||||||
const webDavUri = node.server.address + '/remote.php/webdav/'
|
const webDavUri = node.server.address + '/remote.php/webdav/'
|
||||||
const client = webdav(webDavUri, node.server.credentials.user, node.server.credentials.pass)
|
const client = webdav(webDavUri, node.server.credentials.user, node.server.credentials.pass)
|
||||||
let directory = '/'
|
let directory = ''
|
||||||
if (node.directory && node.directory.length) {
|
if (msg.directory) {
|
||||||
directory += node.directory + '/'
|
directory = '/' + msg.directory
|
||||||
directory = directory.replace('//', '/')
|
} else if (node.directory && node.directory.length) {
|
||||||
|
directory = '/' + node.directory
|
||||||
}
|
}
|
||||||
|
directory = directory.replace('//', '/')
|
||||||
|
|
||||||
client.getDirectoryContents(directory)
|
client.getDirectoryContents(directory)
|
||||||
.then(function (contents) {
|
.then(function (contents) {
|
||||||
node.send({'payload': contents})
|
node.send({'payload': contents})
|
||||||
@ -159,6 +162,7 @@ module.exports = function(RED) {
|
|||||||
node.on('input', function(msg) {
|
node.on('input', function(msg) {
|
||||||
const webDavUri = node.server.address + '/remote.php/webdav/'
|
const webDavUri = node.server.address + '/remote.php/webdav/'
|
||||||
const client = webdav(webDavUri, node.server.credentials.user, node.server.credentials.pass)
|
const client = webdav(webDavUri, node.server.credentials.user, node.server.credentials.pass)
|
||||||
|
let filename = ''
|
||||||
if (msg.filename) {
|
if (msg.filename) {
|
||||||
filename = '/' + msg.filename
|
filename = '/' + msg.filename
|
||||||
} else if (node.filename && node.filename.length) {
|
} else if (node.filename && node.filename.length) {
|
||||||
|
|||||||
Reference in New Issue
Block a user