Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions pyftpdlib/handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2992,12 +2992,14 @@ def ftp_OPTS(self, line):
if line.count(' ') > 1:
raise ValueError('Invalid number of arguments')
if ' ' in line:
cmd, arg = line.split(' ')
if ';' not in arg:
raise ValueError('Invalid argument')
cmd, arg = line.split(' ')
else:
cmd, arg = line, ''
# actually the only command able to accept options is MLST
if cmd.upper() in ("UTF8", "UTF-8"):
self.respond('200 Always in UTF8 mode.')
return
if arg and ';' not in arg:
raise ValueError('Invalid argument')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this bit should be moved down to just above the facts = [x.lower() for x in arg.split(';')] line?
https://www.rfc-editor.org/rfc/rfc2389#section-4 says command-options = <format specified by individual FTP command> and I think the semicolon in command-options is specific to MLST?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation of raise ValueError seems incorrect

if cmd.upper() != 'MLST' or 'MLST' not in self.proto_cmds:
raise ValueError('Unsupported command "%s"' % cmd)
except ValueError as err:
Expand Down