Opened 8 years ago
Last modified 3 months ago
Currently we special case a few options in ftp_LIST. This sucks and we should do something better.
Beside the current code:
# bug in konqueror if path == "-a": path = '' # bug in gFTP 2.0.15 if path == "-aL": path = '' # bug in Nautilus 2.10.0 if path == "-L": path = '' # bug in ange-ftp if path == "-la": path = ''
I have also discovered the following clients:
# bug in FireFTP if path == "-al": path = '' # bug in BareFTP if path == "-La": path = ''
Maybe we can use a regex or something simple like:
if path.lower() in ['-a', '-l', '-la', '-al']: path = ''
Replying to adiroiban:
Maybe we can use a regex or something simple like: {{{ if path.lower() in ['-a', '-l', '-la', '-al']: path = }}}
I like this approach. Obviously it needs tests etc. I'll make a patch, if I don't fall asleep or otherwise get distracted first :)
(In [34787]) Branch to ftp-list-flags-1333
1. Please name the test test_LISTWithBinLsFlags and add a docstring.
2. This needs a NEWS fragment.
Thanks, merge once those points are fixed!
#5791 has been closed a duplicate of this bug.
I have attached a patch on top of branch 1333
I have renamed the test and add docstring. Also added docstring and renaming for neighbor tests.
It looks like the branch already has a news file.
Please switch to git/github. Working with SVN is so slow, Trac code navigation is slow and uploading patched to tickets is not fun.
(In [37410]) Branching to ftp-list-flags-1333-2.
(In [37413]) Merge ftp-list-flags-1333-2: Handle bogus options to ftp's LIST command.
Author: spiv, adiroiban Reviewers: therve, tom.prince Fixes: #1333
The twisted.protocols.ftp.FTP server now treats "LIST -La", "LIST -al", and all other combinations of ordering and case of the "-l" and "-a" flags the same: by ignoring them rather than treating them as a pathname.
(I accidentally put my review on #5411 by mistake:)
Minor change: Prefer assertIn to assertTrue(... in ...).
I've fixed this up and merged forward.
Will merge once build results are in.