Closed madjar closed 12 years ago
Wouldn't it be a matter of removing a '+' sign in the regex?
Well, maybe. The modification date seems left-aligned, so it might do the trick.
The problem is : is it always ? Could other servers have slightly different output ?
I did run into whitespace problems before (b8186dacc61219a4638682a471db51630c71e130 fixes the case when modification date has a 1-digit day of month), so I suggest testing against different real-world FTP softwares (hopefully the school will be a great testing ground).
Well, are you sure you don't want to use an existing ftp library (one that is higher level than ftplib)? Parsing a variable ill-defined output is not the most interesting thing we can do.
If you're thinking about ftputil, I don't see the point if we're going to have to work-around the same bugs in their code...
I'm not sure I understand. Don't they have some code for detecting ill-formed server output ?
Also, it looks like they handle Unix and MS servers in different ways. Maybe we'll have to deal with the same problem at some point.
Anyway, let's keep our homebrew approach for now. If another parsing problem arise in the future, we'll think again about switching to an existing implementation.
The whitespaces in the beginning of a file name are ignored. This can lead to strange behaviors when the owner of the server is a sadistic bastard and have files with the same name except the leading whitespaces.
A test highlighting this bug has been added with commit 36357b333c410b3adcb15caaf4d4959c8e1e8396.