Feature upload download semantics

Fix some bugs that looked like semantic errors
Modify upload and download semantics when the destination argument is missing.
Before this commit, the destination was resolved to be the same as the source, including the explicitly described directory tree e.g.,  /tmp/dir/file.txt  -->  tmp/dir/file.txt
After this commit, the destination will be resolved as the basename of the source path e.g., /tmp/dir/file.txt --> file.txt

Suggested reviewer: @iliastsi