From 49647b51d04ea704ff00f872d2beb327595fdc6a Mon Sep 17 00:00:00 2001 From: "http://smcv.pseudorandom.co.uk/" Date: Sat, 22 Feb 2014 19:24:58 -0400 Subject: [PATCH] review --- ...ype_is_application__47__octet-stream....mdwn | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/doc/bugs/can__39__t_upload_a_simple_png_image:_prohibited_by_allowed__95__attachments___40__file_MIME_type_is_application__47__octet-stream....mdwn b/doc/bugs/can__39__t_upload_a_simple_png_image:_prohibited_by_allowed__95__attachments___40__file_MIME_type_is_application__47__octet-stream....mdwn index 1f893b980..b55605245 100644 --- a/doc/bugs/can__39__t_upload_a_simple_png_image:_prohibited_by_allowed__95__attachments___40__file_MIME_type_is_application__47__octet-stream....mdwn +++ b/doc/bugs/can__39__t_upload_a_simple_png_image:_prohibited_by_allowed__95__attachments___40__file_MIME_type_is_application__47__octet-stream....mdwn @@ -55,3 +55,20 @@ Weird... --[[anarcat]] > > I have a stupid [[patch]] in my git repo which just appends a semicolon to the `::magic()` output, but maybe this should be done in another way... > > > > --[[anarcat]] + +> > > If the regex match isn't necessary and it's just about deleting the +> > > parameters, I think I'd prefer something like +> > > +> > > if (! defined $mimetype) { +> > > ... +> > > } +> > > $mimetype =~ s/;.*//; +> > > +> > > but I'd be hesitant to do that without knowing why Joey implemented it +> > > the way it is. If it's about catching a result from file(1) that +> > > is not, in fact, a MIME type at all (empty string or error message +> > > or something), maybe something more like this? +> > > +> > > if (! defined $mimetype || $mimetype !~ s{[-\w]+/[-\w]+(?:;.*)?}{}) +> > > +> > > (or whatever the allowed characters in MIME types are). --[[smcv]] -- 2.39.5