[tahoe-dev] File types and encodings
Jeremy Fitzhardinge
jeremy at goop.org
Tue Mar 9 12:45:00 PST 2010
On 03/09/2010 11:30 AM, David-Sarah Hopwood wrote:
> Jeremy Fitzhardinge wrote:
>
>> I've noticed that the webapi tends to return fairly arbitrary
>> Content-types headers when fetching files; it seems to use its own
>> internal extension to mime type table, and if that fails it defaults to
>> text/plain.
>>
>> Given that a directory supports arbitrary metadata for file entries, it
>> would seem like an obvious extension to define a metadata tag for mime
>> type ("content-type" or "mime-type"), and have the webapi return that as
>> the content mime type.
>>
> That's possible, but what would set this metadata? Neither the WUI nor
> the CLI have any information about the type other than by guessing.
>
In the webapi, a Content-type header in the PUT request would set it.
The CLI would need to add a command-line option to set it, I suppose, or
guess using the hosts extension -> mime-type conversion ("file
--mime-type" perhaps).
Do browsers attempt to guess the file type for uploads? A mime-type
text field or selection could be added anyway to allow it to be set
manually.
>> As a fallback, using a heuristic table to derive the type is useful for
>> well-known types, but defaulting to text/plain if that fails seems
>> pretty odd. Why not default to application/octet-stream?
>>
> Because "text/plain" does not mean text -- it is treated by browsers as
> meaning "guess the type".
>
> (There is actually no MIME type that is reliably treated as text, which
> is unfortunate.)
>
Is that convention, or is it documented somewhere?
J
More information about the tahoe-dev
mailing list