Remote-ftp: Deleting a remote file or folder does not work in the new Atom 1.52 version.

Created on 16 Oct 2020  ·  14Comments  ·  Source: icetee/remote-ftp

Prerequisites

Description

Deleting a remote file or folder does not work in the new Atom 1.52 version.

Steps to Reproduce

  1. Update Atom to version 1.52.
  2. Connect to a remote project.
  3. Try to delete a file or a folder on a remote project.

Expected behavior: Deletion of a file/folder, directory update.

Actual behavior: Nothing.

Reproduces how often: Always in version 1.52.

Versions

Windows 10. Atom 1.52.0.

Additional Information

Return to version 1.51.0 helps to temporarily avoid the problem.

Most helpful comment

So there is an issue with Atom dialogs which causes it not to call the callbacks that would enable the actual delete. This won't be patched until 1.54, for now, I edited the remote-ftp command.js file with the following code on line 279 and restarted Atom. This causes the delete to happen without prompting, so be careful. Once 1.54 rolls out, just undo the code.

Before

'remote-ftp:delete-selected': {
      enabled: true,
      command() {
        if (!hasProject()) return;

        const remotes = getRemotes('You need to select a folder first');
        if (remotes === false) return;

        atom.confirm({
          message: 'Are you sure you want to delete the selected item ?',
          detailedMessage: `You are deleting:${remotes.map(view => `\n  ${view.item.remote}`)}`,
          buttons: {
            'Move to Trash': () => {
              remotes.forEach((view) => {
                if (!view) return;

                const dir = Path.dirname(view.item.remote).replace(/\\/g, '/');
                const parent = remoteftp.treeView.resolve(dir);

                client.delete(view.item.remote, (err) => {
                  if (!err && parent) {
                    parent.open();
                  }
                });
              });
            },
            Cancel: null,
          },
        });
      },

After

'remote-ftp:delete-selected': {
      enabled: true,
      command() {
        if (!hasProject()) return;

        const remotes = getRemotes('You need to select a folder first');
        if (remotes === false) return;

        remotes.forEach((view) => {
          if (!view) return;

          const dir = Path.dirname(view.item.remote).replace(/\\/g, '/');
          const parent = remoteftp.treeView.resolve(dir);

          client.delete(view.item.remote, (err) => {
            if (!err && parent) {
              parent.open();
            }
          });
        });

        // atom.confirm({
        //   message: 'Are you sure you want to delete the selected item ?',
        //   detailedMessage: `You are deleting:${remotes.map(view => `\n  ${view.item.remote}`)}`,
        //   buttons: {
        //     'Move to Trash': () => {
        //       remotes.forEach((view) => {
        //         if (!view) return;
        // 
        //         const dir = Path.dirname(view.item.remote).replace(/\\/g, '/');
        //         const parent = remoteftp.treeView.resolve(dir);
        // 
        //         client.delete(view.item.remote, (err) => {
        //           if (!err && parent) {
        //             parent.open();
        //           }
        //         });
        //       });
        //     },
        //     Cancel: null,
        //   },
        // });
      },
    },

All 14 comments

Have the same issue. Why are these updates released without extensive testing?!

Have the same issue. Why are these updates released without extensive testing?!

I guess this is a problem with the package, not the Atom. Most probably, the package code uses functionality that has become unavailable in the new IDE version.

The same issue on MacOS after update Atom to version 1.52.

Have the same issue on Windows after update Atom. No command sent to the sftp or ftp server when we do the action.

Same issue here, i wonder if this is being worked on.

Same here since last atom update : mac os, and windows 10

edit : 11/11/2020 : same problem with atom last release (1.53)

Same here, Atom v1.52 and v1.53 on MacOS High Sierra 10.13.6

So there is an issue with Atom dialogs which causes it not to call the callbacks that would enable the actual delete. This won't be patched until 1.54, for now, I edited the remote-ftp command.js file with the following code on line 279 and restarted Atom. This causes the delete to happen without prompting, so be careful. Once 1.54 rolls out, just undo the code.

Before

'remote-ftp:delete-selected': {
      enabled: true,
      command() {
        if (!hasProject()) return;

        const remotes = getRemotes('You need to select a folder first');
        if (remotes === false) return;

        atom.confirm({
          message: 'Are you sure you want to delete the selected item ?',
          detailedMessage: `You are deleting:${remotes.map(view => `\n  ${view.item.remote}`)}`,
          buttons: {
            'Move to Trash': () => {
              remotes.forEach((view) => {
                if (!view) return;

                const dir = Path.dirname(view.item.remote).replace(/\\/g, '/');
                const parent = remoteftp.treeView.resolve(dir);

                client.delete(view.item.remote, (err) => {
                  if (!err && parent) {
                    parent.open();
                  }
                });
              });
            },
            Cancel: null,
          },
        });
      },

After

'remote-ftp:delete-selected': {
      enabled: true,
      command() {
        if (!hasProject()) return;

        const remotes = getRemotes('You need to select a folder first');
        if (remotes === false) return;

        remotes.forEach((view) => {
          if (!view) return;

          const dir = Path.dirname(view.item.remote).replace(/\\/g, '/');
          const parent = remoteftp.treeView.resolve(dir);

          client.delete(view.item.remote, (err) => {
            if (!err && parent) {
              parent.open();
            }
          });
        });

        // atom.confirm({
        //   message: 'Are you sure you want to delete the selected item ?',
        //   detailedMessage: `You are deleting:${remotes.map(view => `\n  ${view.item.remote}`)}`,
        //   buttons: {
        //     'Move to Trash': () => {
        //       remotes.forEach((view) => {
        //         if (!view) return;
        // 
        //         const dir = Path.dirname(view.item.remote).replace(/\\/g, '/');
        //         const parent = remoteftp.treeView.resolve(dir);
        // 
        //         client.delete(view.item.remote, (err) => {
        //           if (!err && parent) {
        //             parent.open();
        //           }
        //         });
        //       });
        //     },
        //     Cancel: null,
        //   },
        // });
      },
    },

I suggest you revert to an earlier version or use the 1.54.0-beta0.

It could be another 1 month for the next version. :(

https://github.com/icetee/remote-ftp/issues/1347#issuecomment-726282213
Works for me! Thank you man.

Remember restart Atom after make this.

@maurice-ellis -Thank you for the temp fix. Works great.

Is the error still present? There is a new version. v1.54.0

No, the error is no longer present. I reverted back to your original code and it deletes fine now.

No, the error is no longer present. I reverted back to your original code and it deletes fine now.

Thank you, the answer. There was no feedback from anyone else, I close this issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

elebumm picture elebumm  ·  7Comments

Darkspirit picture Darkspirit  ·  4Comments

matthew-e-brown picture matthew-e-brown  ·  6Comments

fausto160792 picture fausto160792  ·  7Comments

querysol picture querysol  ·  7Comments