mscp
mscp copied to clipboard
copy fails when the destination path has suffix '/' but does not exist
- When a destination directory
dstis empty, copy a filetestas a different nameasdfunder the directorydstworks.
ryzen1 ~/w/m/build > ./mscp test localhost:dst/asdf
[=============================================] 100% 1024.0KB/1.0MB 8.3MB/s 00:00
- When a destination directory
dstis empty, copy a filetestas a different nameasdf/under the directorydstfails: mscp created a directorydst/asdfand then exited with the error:
ryzen1 ~/w/m/build > ./mscp test localhost:dst/asdf/
thread[0]: copy failed: test -> dst/asdf/, 0x0000000000-0x0000100000, [path.c:311:touch_dst_path] mscp_open dst/asdf/: Transport endpoint is not connected
[ ] 0% 0.0B /1.0MB 0.0B/s --:-- ETA
2.1. After that, copy the file test with the same destination path dst/asdf/ works: test is coppied as dst/asdf/test (because the directory dst/asdf/ already exists):
ryzen1 ~/w/m/build > ./mscp test localhost:dst/asdf/
[=============================================] 100% 1024.0KB/1.0MB 8.6MB/s 00:00
ryzen1 ~/w/m/build > ls ~/dst/asdf 0.386s dev 16:24
test
The expected behavior is that when the destination path is dst/asdf/ on the case 2, mscp should create the directory dst/asdf and copy test to dst/asdf/test.