humy2833 / FTP-Simple

visual studio code extension
107 stars 38 forks source link

ftp-simple config error #326

Open stela-p opened 1 week ago

stela-p commented 1 week ago

i'm working on mac, just installed Visual Studio Code and Ftp-Simple extension. Trying to configure (ftp-simple:config-connection setting) I keep getting an error.

Screenshot 2024-09-07 at 21 06 48
PubliusEnigmas commented 1 week ago

Same here but this time on Win.

The ftp-simple extension WAS working fine in VS Code and I could remotely configure the settings and remotely connect, make changes to a remote server etc., as expected. As remote debugging is not supported, I installed Microsoft's Remote-SSH extension. After that installation, the ftp-simple never worked again prompting the attached message.

I tried unistalling all extensions via the VS code, I uninstalled the VS Code itself and I deleted manually the folder related to the VS code and/or to the extensions to no avail. After five times of uninstall/install and even rollback the extension to a previous version, I'm still getting the error. I even tried to create a ftp-simple-temp.json as it was missing but still failed. As you may observe the ftp-simple is running to the correct workspace shown in the 'output' tab.

ftp-simple config error

omneina commented 1 week ago

The same here. Screenshot 2024-09-08 160327

sheplen commented 1 week ago

same

M-hanif commented 1 week ago

same here

Codingale commented 1 week ago

There's a fork right now at https://github.com/humy2833/FTP-Simple/issues/324#issuecomment-2337353138

Maintained by yunusga.

duplicate of #324 and #321, please try to look at recent issues when posting

emrenacar commented 1 week ago

I had the same error, it was fixed when I reinstalled the previous version of vscode.

stela-p commented 1 week ago

Thank you all for the tips! I just installed the previous version and it worked.

peetcc commented 1 week ago

I investigated this today (9 Sept) because I use this extension EVERY DAY, ALL DAY.

After the VSCODE v1.93 upgrade on Friday 6 Sept 2024 a newer version of NodeJS was introduced that causes the error. Some Buffer class involved, whatever.

I managed to fix it for me by editing 2 lines of code in the extension.js file and then I re-created the setup JSON file by hand and it was ok again.

The setup file is encrypted when you save, and decrypted when you run the CONFIG command and see the pure JSON on your screen. On disk it is always encrypted. The crash problem is in the encryption/decryption.

Essentialy removing the encryption/decryption of the settings file made it working again. But then the password is exposed.

That is of course a temporary solution, but I now understand what needs to be done for a permanent fix.

The Changes I made for the temporary fix is:

function writeConfigFile(json) { // fileUtil.writeFileSync(CONFIG_PATH, cryptoUtil.encrypt(JSON.stringify(json, null, '\t'))); // <<<==== CHNANGED THIS LINE TO THE ONE BELOW fileUtil.writeFileSync(CONFIG_PATH, JSON.stringify(json, null, '\t')); fileUtil.rm(CONFIG_PATH_TEMP); } function initConfig() { var result = true; var json = vsUtil.getConfig(CONFIG_NAME); try { // json = cryptoUtil.decrypt(json); // <<<==== COMMENTED OUT THIS LINE json = JSON.parse(json); } catch (e) {

My suggestion going forward is :

  1. Use the secretStorage API for the password (or everything) instead of encrypted JSON files.
  2. Clean up and maybe redesign the code for this extension, the code 'smells'

cheers.