emacs-ssh-deploy icon indicating copy to clipboard operation
emacs-ssh-deploy copied to clipboard

Wrong upload path if remote path doesn't end with "/"

Open UndeadKernel opened this issue 1 year ago • 0 comments

When setting the variable ssh-deploy-root-local to a string that doesn't end with /, the function ssh-deploy--get-relative-path returns an incorrect path. This is because that function uses replace-regexp-in-string and that regular expression will return the match starting with a /. Then, the function expand-file-name (in line 1148 of ssh-deploy.el) will incorrectly think that it's working with an absolute path and will return the path as given.

This is something that would trigger this problem:

         (ssh-deploy-root-remote . "/ssh:remote-host:folder/")
         (ssh-deploy-root-local . "/home/user/folder")

Note that in the last example ssh-deploy-root-local doesn't end with a /. Therefore, with that configuration, when deploying something, the deployed file will be incorrectly tried to be placed in the root directory.

UndeadKernel avatar Jul 22 '24 10:07 UndeadKernel