From: Johannes Zellner Date: Mon, 30 Nov 2015 15:03:56 +0000 (+0100) Subject: Fix relative path detection X-Git-Url: https://git.immae.eu/?p=perso%2FImmae%2FProjets%2FNodejs%2FSurfer.git;a=commitdiff_plain;h=d904812f219c0fa82837b66b18271e5f34e4fe32 Fix relative path detection --- diff --git a/cli/actions.js b/cli/actions.js index 25643da..70803b2 100644 --- a/cli/actions.js +++ b/cli/actions.js @@ -97,9 +97,10 @@ function put(filePath, otherFilePaths, options) { async.eachSeries(files, function (file, callback) { var relativeFilePath; + if (path.isAbsolute(file)) { relativeFilePath = path.basename(file); - } else if (path.resolve(file).indexOf(process.cwd().length) === 0) { // relative to current dir + } else if (path.resolve(file).indexOf(process.cwd()) === 0) { // relative to current dir relativeFilePath = path.resolve(file).slice(process.cwd().length + 1); } else { // relative but somewhere else relativeFilePath = path.basename(file);