>Branko Čibej <email@example.com> writes:
>>>I would think "application/octet-stream" would be a lot safer when we
>>>don't know anything about the file. Does anyone know more about this?
>>When it sees a file that doesn't have the svn:mime-type property set,
>>Subversion assumes it is a text file. It would be slighly weird if
>>mod_dav_svn behaved differently.
>Subversion can make that assumption because it knows the domain of
>operations (diff, merge) to which the assumption will apply.
>But when we return a file in response to a generic DAV request, we
>have no idea what the user is going to do with it. In fact, it seems
>likely that someone using a generic DAV client to fetch a file will
>often not be obtaining a "text/plain" document. It's just as likely
>to be MSWord, Excel, whatever, and that some software consumers of the
>file would Do The Wrong Thing if they thought were plain text.
If it's really not a text file, Subversion will tag it as
application/octet-stream itself when you add the file to the repository.
(Well, we should really do the binary check every time we commit
changes, if svn:mime-type is not set. But that's a different issue.)
>Also, notice how the "text/plain" assumption is given lie in
>mod_dav_svn/repos.c, right below the code we're talking about:
> if (value)
> mimetype = value->data;
> else if ((! resource->info->repos->is_svn_client)
> && r->content_type)
> mimetype = r->content_type;
> mimetype = "text/plain";
> serr = svn_mime_type_validate(mimetype, resource->pool);
> if (serr)
> /* Probably serr->apr == SVN_ERR_BAD_MIME_TYPE, but
> there's no point even checking. No matter what the
> error is, we can't derive the mime type from the
> svn:mime-type property. So we resort to the infamous
> "mime type of last resort." */
> mimetype = "application/octet-stream";
>Kind of hard to square that last assignment with the final 'else'
Not really. This will catch the case where the mime type was set either
in the prop or (I assume) by mod_mime, *but* the syntax of the value
wasn't valid. In that case generic binary is a better choice than either
generic text or (obviously) an invalid type. Note that
svn_mime_type_validate won't trigger for "text/plain", which we only set
explicitly if the svn:mime-type prop doesn't exist at all.
To unsubscribe, e-mail: firstname.lastname@example.org
For additional commands, e-mail: email@example.com
Received on Thu May 5 01:54:12 2005