     .action (name, options) ->
       par = _.extend {}, defaultOptions, _.pick options, ['path', 'size'].concat _.keys defaultOptions
       par.localpath = name
+      par.path += Path.basename par.localpath if _.endsWith par.path, '/'
       fn = if par.size then cmdPutSession else cmdPut
       fn par
 

        'Content-Type': mime.lookup options.localpath
      method: 'POST'
      json: yes
    request par, (err, resp, body) ->
      logger.debug 'createUploadSession', body
      hooks.session = body

request = require 'request'
async   = require 'async'
Path    = require 'path'
_       = require 'lodash'
program = require 'commander'
fs      = require 'fs'
