Skip to content

Commit 7b774c2

Browse files
authored
simple fix for FTP LIST command returning leading 'total x' (#1503)
1 parent 259215f commit 7b774c2

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

fsspec/implementations/ftp.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -364,15 +364,17 @@ def _mlsd2(ftp, path="."):
364364
minfo = []
365365
ftp.dir(path, lines.append)
366366
for line in lines:
367-
line = line.split()
367+
split_line = line.split()
368+
if len(split_line) < 9:
369+
continue
368370
this = (
369-
line[-1],
371+
split_line[-1],
370372
{
371-
"modify": " ".join(line[5:8]),
372-
"unix.owner": line[2],
373-
"unix.group": line[3],
374-
"unix.mode": line[0],
375-
"size": line[4],
373+
"modify": " ".join(split_line[5:8]),
374+
"unix.owner": split_line[2],
375+
"unix.group": split_line[3],
376+
"unix.mode": split_line[0],
377+
"size": split_line[4],
376378
},
377379
)
378380
if "d" == this[1]["unix.mode"][0]:

0 commit comments

Comments
 (0)