Re: Assuming "text/plain" for text-like MIME sniffing buffers often leads to problems
- From: Alexander Larsson <alexl redhat com>
- To: Christophe Fergeau <teuf gnome org>
- Cc: gnome-vfs-list gnome org
- Subject: Re: Assuming "text/plain" for text-like MIME sniffing buffers often leads to problems
- Date: Thu, 20 Apr 2006 18:05:51 +0200
On Thu, 2006-04-20 at 17:21 +0200, Christophe Fergeau wrote:
> Le jeudi 20 avril 2006 à 17:17 +0200, Alexander Larsson a écrit :
> > On Fri, 2006-03-24 at 20:31 +0100, Christian Neumair wrote:
> > > When no MIME type is found to match for the contents sniff of a file and
> > > the buffer looks like text, "text/plain" is assumed. When the
> > > subclassing information isn't correct (for instance, the current
> > > shared-mime-info release 0.17 doesn't have "text/plain" =>
> > > "application/pdf" associations), this will make the contents sniff take
> > > precedence over the extension and for instance evince can't handle the
> > > file, and Nautilus will bail when activating the file.
> > > I therefore propose to always return XDG_MIME_TYPE_UNKNOWN if the result
> > > can't be determined.
> >
> > A pdf sniffed as text? That sounds strange.
> >
> > Anyway, I think this sounds wrong. We'll detect far less text files if
> > we do this, meaning you'll be unable to open them instead. Getting the
> > mime info fixed seems like a better solution.
>
> 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
Totally. What type was this?
> 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.
Yeah, this sounds like a good idea.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Alexander Larsson Red Hat, Inc
alexl redhat com alla lysator liu se
He's an uncontrollable Jewish card sharp from the Mississippi delta. She's a
strong-willed French-Canadian mermaid with a birthmark shaped like Liberty's
torch. They fight crime!
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]