[Zope-CMF] Fwd: [CMF] 281/ 1 Request "FSFile content_type weakness"

Dieter Maurer dieter at handshake.de
Sun Sep 5 14:41:56 EDT 2004


Jens Vagelpohl wrote at 2004-9-5 13:13 +0200:
>> Uploaded:  "FSFile.pat"
>>  - http://zope.org/Collectors/CMF/281/FSFile.pat/view
>> The way the content_type is detected in CMFCore.FSFile prevents 
>> content_type to be explicitly specified inside a .metadata file for 
>> the resource since any content_type value coming from the .metadata 
>> file is disregarded. This small patch will, as a last resort, use a 
>> content_type specification from the .metadata file *if* it is obvious 
>> that the normal content_type detection has failed, meaning it returned 
>> "application/octet-stream".
>>
>> Specific use case for this change: I am trying to store a favicon.ico 
>> file on the file system. Without the patch it will always have 
>> "application/octet-stream" and that makes some browsers unhappy.
>
>Any objections to me merging this patch:

I think the value provided in the metadata file should always
be used whether or not the content type guessing resulted
in "application/octed-stream".

The implementation of this may be a bit tricky because
the object does not know whether a value was provided by
a metadata file or a previous guess.

I think the metadata handling is flawed as a whole because
it is not the object itself that reads its metadata but
the containing FSDirectoryView. Whould the object itself
handle its metadata then it could easily check whether
a specific value came from the metadata file or was
determined in other ways. Furthermore, it would be much
more natural than the handling by an unrelated object.


-- 
Dieter


More information about the Zope-CMF mailing list