From af65f135f338c550250673dda3e53f9e5f08e50f Mon Sep 17 00:00:00 2001 From: HexPandaa <47880094+HexPandaa@users.noreply.github.com> Date: Mon, 10 Aug 2020 11:00:45 +0200 Subject: [PATCH 1/2] Adding a colon if necessary in purge command Uniformized the appending of a colon after the fs accross functions Adding a missing return after an early reject and two semicolons Correcting a typo, `fs` to `remoteName` --- src/index.js | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/index.js b/src/index.js index b204eff..13d3522 100644 --- a/src/index.js +++ b/src/index.js @@ -56,7 +56,9 @@ export const setCurrentBandwidthSetting = (newRate) => { * @returns {Function} */ export const createNewPublicLink = (remoteName, remotePath) => { - remoteName = tools.addColonAtLast(remoteName); + if (!isLocalRemoteName(remoteName)) { + fs = addColonAtLast(remoteName); + } return new Promise((resolve, reject) => { axiosInstance.post(urls.createPublicLink, {fs: remoteName, remote: remotePath}).then(res => { resolve(res.data); @@ -123,11 +125,13 @@ export const getFsInfo = (remoteName) => { export const getFilesList = (fs, remotePath) => { return new Promise((resolve, reject) => { if(!fs || fs === ""){ - reject("Invalid fs specified") + reject("Invalid fs specified"); + return; } - // check if it is a local path - fs = fs.indexOf('/') !== 0 ? addColonAtLast(fs) : fs; + if (!isLocalRemoteName(fs)) { + fs = addColonAtLast(fs); + } axiosInstance.post(urls.getFilesList, { fs, @@ -150,8 +154,8 @@ export const getRemoteInfo = (remoteName) => { return new Promise((resolve, reject) => { if(!remoteName) { - reject("Invalid remote name specified") - return + reject("Invalid remote name specified"); + return; } if (!isLocalRemoteName(remoteName)) { @@ -219,6 +223,9 @@ export const getJobStatus = (jobId) => { * @return {Promise} */ export const purgeDir = (fs , remote) => { + if (!isLocalRemoteName(fs)) { + fs = addColonAtLast(fs); + } return new Promise((resolve, reject) => { axiosInstance.post(urls.purge, { fs, @@ -239,7 +246,9 @@ export const purgeDir = (fs , remote) => { * @return {Promise} */ export const deleteFile = (fs , remote) => { - fs = addColonAtLast(fs) + if (!isLocalRemoteName(fs)) { + fs = addColonAtLast(fs); + } return new Promise((resolve, reject) => { axiosInstance.post(urls.deleteFile, { fs, From bc6b1b7f9cfdb0742f41a15fdb5e12e49a5c8a96 Mon Sep 17 00:00:00 2001 From: Chaitanya Bankanhal Date: Mon, 10 Aug 2020 23:26:51 +0530 Subject: [PATCH 2/2] 1.0.9 --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index db1bdee..c49cefe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "rclone-api", - "version": "1.0.8", + "version": "1.0.9", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 4cf3257..359c8d7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rclone-api", - "version": "1.0.8", + "version": "1.0.9", "description": "Java Script bindings for rclone rc api", "main": "lib/index.js", "scripts": {