From 1c20715d8249ae081aae56f27e12e225282e9e38 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Fri, 27 Nov 2015 16:08:08 -0800 Subject: fix path resolution --- cli/actions.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cli/actions.js b/cli/actions.js index 6fb9893..735b631 100644 --- a/cli/actions.js +++ b/cli/actions.js @@ -93,7 +93,15 @@ function put(filePath, otherFilePaths, options) { var files = collectFiles([ filePath ].concat(otherFilePaths)); async.eachSeries(files, function (file, callback) { - var relativeFilePath = path.resolve(file).slice(process.cwd().length + 1); + var relativeFilePath; + if (path.isAbsolute(file)) { + relativeFilePath = path.basename(file); + } else if (path.resolve(file).indexOf(process.cwd().length) === 0) { // relative to current dir + relativeFilePath = path.resolve(file).slice(process.cwd().length + 1); + } else { // relative but somewhere else + relativeFilePath = path.basename(file); + } + var destinationPath = (options.destination ? '/' + options.destination : '') + '/' + relativeFilePath; console.log('Uploading file %s -> %s', relativeFilePath.cyan, destinationPath.cyan); -- cgit v1.2.3