mscp icon indicating copy to clipboard operation
mscp copied to clipboard

copy fails when the destination path has suffix '/' but does not exist

Open upa opened this issue 1 year ago • 0 comments

  1. When a destination directory dst is empty, copy a file test as a different name asdf under the directory dst works.
ryzen1 ~/w/m/build > ./mscp test localhost:dst/asdf
[=============================================] 100% 1024.0KB/1.0MB    8.3MB/s  00:00 
  1. When a destination directory dst is empty, copy a file test as a different name asdf/ under the directory dst fails: mscp created a directory dst/asdf and 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.

upa avatar Aug 19 '24 07:08 upa