@@ -494,6 +494,7 @@ def _addline(status, line):
494
494
elif res_type in ("cdir" , "pdir" ):
495
495
pass
496
496
else :
497
+ write_error ("Could not parse '{}'" .format (line ))
497
498
raise NotImplementedError (
498
499
"MLSD returned unsupported type: {!r}" .format (res_type )
499
500
)
@@ -719,6 +720,7 @@ def _ftp_retrlines_native(self, command, callback, encoding):
719
720
720
721
def _on_read_line (line ):
721
722
# Line is a byte string
723
+ # print(" line ", line)
722
724
status = 2 # fault
723
725
line_decoded = None
724
726
try :
@@ -731,7 +733,6 @@ def _on_read_line(line):
731
733
status = 1 # used fallback encoding
732
734
except UnicodeDecodeError :
733
735
raise
734
- # pass # fault
735
736
736
737
if compat .PY2 :
737
738
# line is a native binary `str`.
@@ -748,17 +749,19 @@ def _on_read_line(line):
748
749
749
750
def _on_read_chunk (chunk ):
750
751
buffer = local_var ["buffer" ]
751
- # print("read_c()", chunk, buffer)
752
752
# Normalize line endings
753
753
chunk = chunk .replace (b"\r \n " , LF )
754
754
chunk = chunk .replace (b"\r " , LF )
755
+ chunk = buffer + chunk
755
756
try :
757
+ # print("Add chunk ", chunk, "to buffer", buffer)
756
758
while True :
757
759
item , chunk = chunk .split (LF , 1 )
758
760
_on_read_line (item ) # + LF)
759
761
except ValueError :
760
- buffer += chunk
761
- # print("Add chunk ", chunk, "to buffer", buffer)
762
+ pass
763
+ # print("Rest chunk", chunk)
764
+ local_var ["buffer" ] = chunk
762
765
763
766
self .ftp .retrbinary (command , _on_read_chunk )
764
767
0 commit comments