la-haute-societe / ssh-deploy-release

Deploy releases over SSH with rsync, archive ZIP / TAR, symlinks, SCP ...
https://www.npmjs.com/package/ssh-deploy-release
MIT License
36 stars 10 forks source link

[BUG] `remote.upload` only work work for single files in working directory #29

Closed xstable closed 2 years ago

xstable commented 2 years ago

I tried to use the upload.remote function to upload a .env-file from my local pc to the target directory at the server. The .env-File is placed in ../private from the perspective of the working directory, where the deploy-script was started /backend.

image

Nevertheless what I try, I got "Error: No such File".

Found the BUG

I've did some debuging, and figured out, that the implementation of upload.remote was logical wrong:

image`

This piece of code shows, that the src is always added to the server-target path. This fully breaks the functionality, if your src is not equal to a single filename without any path.

Example:

$src = '/home/me/private/myFileToUpload.txt';
$target = '/var/www/serverRoot/';
sftp.fastPut(src, `${target}/${src}`

Will try to upload the file to:

/var/www/serverRoot//home/me/private/myFileToUpload.txt