In SFTP, do not add '/' if homedir ends with one #9844
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When using SFTP and a path relative to the user home, do not add a trailing '/' to the user home dir if it already ends with one.
Background:
We have an SFTP server which serves files out of a virtual directory structure. Because of this, the "HOME" directory for all users is "/" by configuration (we do not have user home directories in the virtual filesystem).
When using curl to upload files with a command such as this:
curl -T file_to_upload.txt sftp://hostname/~/folder/
curl first resolves the home directory to "/" and then uploads the file with this filename:
//folder/file_to_upload.txt
In our case, this caused the path to be misinterpreted as a network path which ultimately caused the upload to fail. We will implement a fix in the SFTP server for this.
The fix here is simply such that curl uploads the file with this filename instead in this situation:
/folder/file_to_upload.txt
which is the intended path I believe.