Re: [dcdev] Searching
Fredrik Tolf
2004-01-16 6:47
Direct Connect developers

Carl-Adam Brengesjö writes:
> Todd Pederzani wrote:
> Guessing MIME types are done by look on the actual data, not just the > name of the file. And therefor searching for a particular file extension > should be done in the filename pattern. So if you want to search for the > _type_ of file, file extension are no good.
> Using MIME types allows the user to search for the _type_ not the > fileextension, and I say again. If you want to search for the file > extension: use the filename pattern!
> > 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.
> > > Sure,  we could basically recreate/port the unix way of guessing mime > > type, but... why?  It gains us nothing, and it adds complexity and > > uncertainty.  Not all will handle MIME guessing the same, so you've just > > introduced interoperability issues.
> > 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?).
> > 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.
> > 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 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

I think that I might have made myself misunderstood. I do agree with
you, really, but only in the perfect world. MIME types are most
certainly superior in theory, and I certainly don't like determining
the file type from the extension (note, however, that Windoze
determines MIME types from the extension...).

The problem is that there are too many MIME types in this world that
are not standardized, and in my experience, it is especially the file
types that people on DC would be interested in. DC users aren't
typically interested in message/rfc-822 or text/plain - they are
interesting in what _would_ be video/ms-avi, application/rar or
application/iso-9660-img, for example, only those formats are not
standardized. Therefore, MIME types are not of very much interest to
DC users.

However, the last thing I want to do is to ban MIME types from
usage. On the contrary; consider my search format, for example. It can
be implemented at once, or once these file formats have standard MIME
types, but at any point, it's easy to add something like
( M =~ video/.* ). That way, it will be optional in the way that it
should be. Those clients that don't have the MIME type attribute
implemented will simply return false on those queries.

That's my thought.

Fredrik Tolf

DC Developers mailinglist