]> sipb.mit.edu Git - ikiwiki.git/commitdiff
review
authorhttp://smcv.pseudorandom.co.uk/ <smcv@web>
Sat, 22 Feb 2014 23:24:58 +0000 (19:24 -0400)
committeradmin <admin@branchable.com>
Sat, 22 Feb 2014 23:24:58 +0000 (19:24 -0400)
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 1f893b980af6f1b62a6be76cf5809443e98cbe82..b55605245d117afd45d186d12840beda83ea8bfa 100644 (file)
@@ -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]]