Branko Čibej <brane@xbc.nu> 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.
Would it?
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.
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;
else
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." */
svn_error_clear(serr);
mimetype = "application/octet-stream";
}
Kind of hard to square that last assignment with the final 'else'
above it!
-Karl
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu May 5 01:37:15 2005