mar10 / pyftpsync

Synchronize directories using FTP(S), SFTP, or file system access.
https://pyftpsync.readthedocs.io
MIT License
117 stars 25 forks source link

Error when client sends "OPTS UTF8 ON" #45

Closed dfrison01 closed 4 years ago

dfrison01 commented 4 years ago

Hey everyone! Sorry for the inconvenience, but I'm currently having this issue, trying to connect a pyftpsync client to a pyftpdlib server. The client response is: "Could not send 'OPTS UTF8 ON': '501 Invalid argument.'" The pyftpdlib server logs no output.

From my searches, looks like pyftpsync shouldn't be sending this command at all, as it's deprecated. Please correct me if i'm wrong. I appreciate any help!

Python 3.7 pyftpdlib 1.5.6 pyftpsync 3.1.0

mar10 commented 4 years ago

We send this (even if it the command is deprecated), because we want to take every effort to enable UTF-8 handling on the server. If the server does not support it, we issue a message, but proceed as normal.

try:
    # Announce our wish to use UTF-8 to the server as proposed here:
    # See https://tools.ietf.org/html/rfc2389
    # https://www.cerberusftp.com/phpBB3/viewtopic.php?t=2608
    # Note: this was accepted on Strato
    self.ftp.sendcmd("OPTS UTF8 ON")
    if verbose >= 4:
        write("Sent 'OPTS UTF8 ON'.")
except Exception as e:
    write("Could not send 'OPTS UTF8 ON': '{}'".format(e), warning=True)

This should not prevent pyftpsync from connecting to the server. Let me know if you have other problems here.