remram44 / yoppi

An automatic FTP indexer written in Python. Inspired by Yoshi Indexer (written in PHP).
GNU General Public License v3.0
6 stars 2 forks source link

Leading whitespaces are ignored #10

Closed madjar closed 12 years ago

madjar commented 12 years ago

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.

remram44 commented 12 years ago

Wouldn't it be a matter of removing a '+' sign in the regex?

madjar commented 12 years ago

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 ?

remram44 commented 12 years ago

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).

madjar commented 12 years ago

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.

remram44 commented 12 years ago

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...

madjar commented 12 years ago

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.