cjohansson / emacs-ssh-deploy

A deployment plugin via Tramp for Emacs.
GNU General Public License v3.0
154 stars 6 forks source link

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

Open UndeadKernel opened 3 months ago

UndeadKernel commented 3 months ago

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.