On Sat, Jun 04, 2011 at 06:17:22PM +0200, Stefan Sperling wrote:
> On Sat, Jun 04, 2011 at 07:11:05PM +0300, Daniel Shahaf wrote:
> > stsp_at_apache.org wrote on Sat, Jun 04, 2011 at 12:32:28 -0000:
> > > +/* Detect the mime-type of the file at LOCAL_ABSPATH using MAGIC_COOKIE.
> > > + * If the mime-type is binary return the result in *MIMETYPE.
> > > + * If the file is not a binary file or if its mime-type cannot be determined
> > > + * set *MIMETYPE to NULL. Allocate *MIMETYPE in RESULT_POOL.
> > > + * Use SCRATCH_POOL for temporary allocations. */
> > > +svn_error_t *
> > > +svn_magic__detect_binary_mimetype(const char **mimetype,
> > > + const char *local_abspath,
> > > + svn_magic__cookie_t *magic_cookie,
> > > + apr_pool_t *result_pool,
> > > + apr_pool_t *scratch_pool);
> > > +
> > As I said on IRC: I think this API is tailored for the caller and it
> > would seem more natural to me to move the "Ignore the result if it's
> > a binary type" to the caller.
> Feel free to change that if it really bugs you.
> But do we ever care about auto-detecting non-binary mimetypes in svn?
If you still plan on doing this then please take into account the
comment added in r1133367. We should keep flagging UTF-16 files as
"application/octet-stream" (or some other binary type) for now.
But libmagic usually reports them as "text/plain", and the current
code happens to deal fine with that. (Maybe we should add a regression
test for this but I don't have enough time right now...)
Received on 2011-06-08 15:37:36 CEST