-
-
Notifications
You must be signed in to change notification settings - Fork 103
Description
Do you read the FAQ?
Describe the bug
The context
parameters for specifying a local synchronization folder are not working correctly when placed inside a profiles
object. When a profile is activated, the extension either ignores the specified local folder and uploads the entire workspace, or it uploads the local folder itself as a sub-folder to the remote path, resulting in an incorrect file structure on the server. The same configuration works perfectly when placed in a single-profile sftp.json
file at the root level.
This bug prevents the use of multiple profiles for projects that require a specific local subfolder to be synchronized to a distinct remote path.
To be concise, this works by copying the files and subfolders in my local /API folder to the server's /var/www/dev-api
{
"name": "XXX",
"protocol": "sftp",
"port": 22,
"defaultProfile": "dev-api",
"ignore": ["**/node_modules"],
"remotePath": "/var/www/dev-api",
"context": "API",
"uploadOnSave": true
}
But this setting will copy my local /API folder to the server's /var/www/dev-api/API
(by creating a new folder), which is not what expected
{
"name": "XXX",
"protocol": "sftp",
"port": 22,
"defaultProfile": "dev-api",
"profiles": {
"dev-api": {
"ignore": ["**/node_modules"],
"remotePath": "/var/www/dev-api",
"context": "API",
"uploadOnSave": true
},
"dev-app": {
"remotePath": "/var/www/dev-app",
"context": "APP/build",
"uploadOnSave": false
}
}
}
To Reproduce
Steps to reproduce the behavior:
- Create a
sftp.json
file in the.vscode
folder of your workspace with aprofiles
configuration. The configuration should include at least one profile that uses thecontext
ormappings
parameter to specify a local subfolder (e.g.,API
). - Make sure this profile is either the
defaultProfile
or use theSFTP: Set profile
command to activate it. - Make a change to a file inside the local
API
folder. - The
uploadOnSave
feature is enabled and triggers an upload, or you manually run a command likeSFTP: Upload Folder
. - See that the uploaded file is placed in an incorrect remote path, such as
/remote/path/API/file.js
, instead of the expected/remote/path/file.js
.
Expected behavior
When a profile with a context
parameter is active, the contents of the specified local folder should be uploaded to the remotePath
without creating an additional subfolder. For example, a local file at [workspace]/API/file.js
should be uploaded to the remote path [remotePath]/file.js
.
Screenshots
A screenshot of the local file explorer showing the API
subfolder and its contents.
A second screenshot of the remote file structure after an upload, showing the incorrect path .../dev-api/API/file.js
instead of the correct .../dev-api/file.js
.
Desktop (please complete the following information):
- OS: Windows 11 24H2
- VSCode Version: 1.103.1
- Extension Version: 1.16.3
Extension Logs from Startup - required
To provide the necessary logs, please follow the steps below:
- Open VS Code User Settings.
- Set
sftp.debug
totrue
. - Reload the VS Code window.
- Reproduce the problem by performing an upload with the profile active.
- Go to
View > Output
and selectsftp
from the dropdown menu to copy the logs.
I will update this section with the relevant logs once I have them.