Re: [dcdev] Searching
Todd Pederzani
2004-01-17 4:35
Direct Connect developers

Carl-Adam Brengesjö wrote:

I searched on DC now for rar files, using filename pattern "." and `filetype' compressed. What I got was *.zip and *.rar, but what with *.r01, *.r02 (etc) ? Using mime types here would return _all_ files that are rar files.

If they had used a recent WinRAR version, those would be .part##.rar files.  The .R## and .Q## files should be going the way of the dodo (though it looks like you can enable them with the -vn switch, if you must).  What other types of files do you see as having bad extensions and being in need of mime-type guessing?

Not all clients will decide filetypes on extension either. When I did my search described above - I got 7 (SEVEN!!) hits on directories that ended with ".ra", and therefor treated as compressed files (the clients who responded used DC++ 0.303, is this fixed in newer releases?).

What you're seeing is actually a RAR file hit, mangled into a directory result by a bug in 0.303.  And yes, 0.304+ fixes that bug (but still doesn't return ".ra" files in response to a compressed file search).

I say again, filetypes with mime decides the type depending on the actual _data_, what it contains. File extension is basicly just a cheap trick to `know' it's type even before the file has been opened, and can therefor be easily faked - or mistaken.

Nonetheless, file extension is a widely accepted method of doing things.  If we were programming for Mac OS 9.x and were using the creator and type fields of the resource fork (a much nicer concept than either mime type or extension), you'd get no argument from me.

But I seem to be the only one that likes the idea with mime types, and everyone is fighting against me on the subject... `resistance is futile' - at least it seems to be :(

I don't see (in my experience or your arguments) how file extensions are broken.  If you're concerned about simplicity, define a standard set of extensions for a given "type" - or let unix clients use mime-type to sort their shares into types.

I have to say same thing over and over in this matter (with different words) and either is it you that don't understand what I'm saying, or it's me who doesn't understand what I want to be said (or needed to be said) :/ either way we are not making any progress. I give up! :p


- Todd
DC Developers mailinglist