FTPClient.jl icon indicating copy to clipboard operation
FTPClient.jl copied to clipboard

`download` using an absloute path doesn't work if the FTP current directory is not root

Open sylvaticus opened this issue 2 years ago • 0 comments

As from the title, the download function using an absolute path doesn't work if the FTP current directory is not root:

julia> ftp = FTP(hostname = "palantir.boku.ac.at", username = "anonymous", password = "")
URL:       ftp://[email protected]/
Transfer:  passive mode
Security:  none

julia> # Download with relative path works:
       download(ftp,"/Public/ImprovedForestCharacteristics/Readme.txt","test/Readme.txt")
IOStream(<file test/Readme.txt>)

julia> cd(ftp,"/Public")     # cd using abs path

julia> println(ftp.ctxt.url)
ftp://[email protected]//Public/

julia> # This also works:
       download(ftp,"ImprovedForestCharacteristics/Readme.txt","test/Readme.txt")
IOStream(<file test/Readme.txt>)

julia> # But this on doesn't: downloading a file using an absolute path from a working directory
       # not in the root should still work, but it doesn't:
       download(ftp,"/Public/ImprovedForestCharacteristics/Readme.txt","test/Readme.txt")
ERROR: Failed to download /Public/ImprovedForestCharacteristics/Readme.txt. :: LibCURL error #9
Stacktrace:
 [1] macro expansion
   @ ~/.julia/packages/FTPClient/7DJzC/src/FTPC.jl:62 [inlined]
 [2] ftp_perform(ctxt::ConnContext{Bool})
   @ FTPClient ~/.julia/packages/FTPClient/7DJzC/src/conn_context.jl:298
 [3] ftp_get(ctxt::ConnContext{Bool}, file_name::String, save_path::String; mode::FTP_MODE)
   @ FTPClient ~/.julia/packages/FTPClient/7DJzC/src/conn_context.jl:152
 [4] download(ftp::FTP, file_name::String, save_path::String; mode::FTP_MODE)
   @ FTPClient ~/.julia/packages/FTPClient/7DJzC/src/FTPObject.jl:116
 [5] download(ftp::FTP, file_name::String, save_path::String)
   @ FTPClient ~/.julia/packages/FTPClient/7DJzC/src/FTPObject.jl:108
 [6] top-level scope
   @ REPL[66]:3

sylvaticus avatar Jul 13 '23 10:07 sylvaticus