Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

PUBLIC / surfer-okd

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 0
  • Merge Requests 0
  • Pipelines
  • Wiki
  • Snippets
  • Settings
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Branches
  • Tags
  • Contributors
  • Graph
  • Compare
  • Charts
Commit 1c20715d authored 9 years ago by Girish Ramakrishnan's avatar Girish Ramakrishnan
Browse files
Options
  • Browse Files
  • Download
  • Email Patches
  • Plain Diff

fix path resolution

1 parent 755569a3
Show whitespace changes
Inline Side-by-side
Showing with 9 additions and 1 deletions
  • cli/actions.js
cli/actions.js
View file @1c20715
......@@ -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);
......
This diff is collapsed. Click to expand it.
  • Write
  • Preview
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
  • Please register or sign in to post a comment