Re: Assuming "text/plain" for text-like MIME sniffing buffers often leads to problems



Am Donnerstag, den 20.04.2006, 17:21 +0200 schrieb Christophe Fergeau:
> 
> There's a bug explaining what goes wrong in the pdf case: there was a
> change done to make gnome-vfs return MIME_TYPE_UNKNOWN when multiple
> sniffing pattern matches (it used to return the first match I think).
> In
> the pdf case, s-m-i contains 2 sniff patterns for % (yep, % alone),
> and
> one for %PDF-, and the current code decides it's an ambiguous case,
> and
> return MIME_TYPE_UNKNOWN. 
> 1) having single character sniff patterns isn't a great idea
> 2) in ambiguous cases, we should use the mime type coresponding to the
> longest matchinig pattern, and only return UNKNOWN if there are
> several matches of the same length. 

Hrm I've revised my opinion on the "match longest pattern" issue.
Shouldn't we rather use the powerful means of matchlet priority for
letting %PDF have a bigger priority than %?

I admit that just adding a % matchlet might not have been the best idea,
but LaTeX and matlab documents don't really have a clear header, but
sometimes occur without any extensions. We might want to offer a
GnomeVFS wrapper API for returning all the match candidates in such
cases in the long term.

-- 
Christian Neumair <chris gnome-de org>




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]