[Clipart] Problems with the website during/after submission

Jonadab the Unsightly One jonadab at bright.net
Wed Jan 5 18:36:13 PST 2005


Jon Phillips <jon at rejon.org> writes:

>> I've checked into CVS a version of upload_svg.cgi that gives a
>> somewhat friendlier error message to users coming from the front
>> page (or, for that matter, anyone who neglects to specify the
>> filetype).  It also softens a bit the wording on the main error
>> message.
>
> Why does the script need to check the filetype. It seems that this
> should automatically be checked for, right? 

I'm not at all sure it's technically possible to guess right 100% of
the time.  I don't know enough about all of the file formats we
support to know if there is reliable identification magic for all of
them and, if so, that it is.  SVG would be possible to check
definitively, I think, but the formula for doing so is somewhat
complex.  (It is NOT as simple as checking that the string "SVG" or
"svg" occurs; a tarball containing one or more SVG images would match
that, if not compressed, and a binary-format file also could contain
it by pure chance, potentially.  We'll have to be clever; we *might*
even have to actually parse the XML to be sure.)  I don't know enough
about most of the other formats we support (zip, tar, png, gzip) to
know about detecting them.  There's also the small problem that we
support more than one kind of gzipped-something.  That's not
insurmountable, but it complicates matters.

It might be possible to guess right 99% of the time or better, and
eventually I would like to code that (leaving the option for the user
to specify in case we guess wrong in a given instance), but currently
we have not yet done so.

Fundamentally, writing code that guesses filetypes is a hard thing to
get right, and an easy thing to get wrong.  It is not something we
will likely be able to get in place quickly or soon.  I agree it is
something we should do eventually.  When we do do it, there will be
bugs that will have to be worked out.

_For now_ we rely on the user to tell us the format.

-- 
$;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}}
split//,"ten.thgirb\@badanoj$/ --";$\=$ ;-> ();print$/




More information about the clipart mailing list