simple-ftp-deploy icon indicating copy to clipboard operation
simple-ftp-deploy copied to clipboard

IndexError in cdRecursivelly when the cached session was dropped (EOFError)

Open dpc00 opened this issue 2 months ago • 1 comments

A dropped connection on a reused session crashes with IndexError: list index out of range instead of reconnecting or showing an error.

cdRecursivelly does except ftplib.all_errors as e: if str(e).split(None, 1)[0] != '550' (main.py:162-163). ftplib.all_errors includes EOFError, and str(EOFError()) is the empty string, so ''.split(None, 1)[0] raises IndexError. This is what a cached session (reuseSessions, default true) produces when the server has closed the idle control connection.

Reproduced live in Sublime Text 4 with Simple FTP Deploy 1.8.1 installed via Package Control, saving real files in a real project window. To avoid needing a server, ftplib.FTP was replaced by a recording stub (the failing logic is all before/around the network calls). The stub raised EOFError() from cwd(). Result in the ST console:

  File ".../Simple FTP Deploy.sublime-package/main.py", line 289, in upload
    if not self.cdRecursivelly(fullFtpPath, prompt = prompt):
  File ".../main.py", line 163, in cdRecursivelly
    if str(e).split(None, 1)[0] != '550':
IndexError: list index out of range

The upload is lost with no dialog, and the dead session stays in FTP_SESSIONS, so later saves fail the same way until the timeout (default 600 s) expires.

Fix: parts = str(e).split(None, 1); if not parts or parts[0] != '550':, and treat EOFError/OSError as "reconnect once": drop the session from FTP_SESSIONS, call connect() again, retry.

dpc00 avatar Sep 24 '26 16:09 dpc00

Claude reports: closing this after 30 days with no response. Reopen it if it is still relevant.

dpc00 avatar Oct 27 '26 19:10 dpc00