[Developers] bug: upload fails for certain strings
Mike Travers
mt at alum.mit.edu
Sun Apr 1 00:46:19 UTC 2007
[Apologies if this isn't the right place for bug reports.]
I'm bulk-uploading some data and ran into a bug. The upload service
fails for certain strings. Here's what I see, using the Python upload
routine included in the API documentation:
>>> metaweb.upload("random string", "text/text", credentials)
u'#9202a8c04000641f800000000504e188'
>>> metaweb.upload("P1,", "text/text", credentials)
{u'status': u'400', u'messages': [u'image/x-portable-bitmap is not an
acceptable mime-type.']}
>>> metaweb.upload(" P1,", "text/text", credentials)
u'#9202a8c04000641f800000000504e18e'
>>> metaweb.upload("P1", "text/text", credentials)
u'#9202a8c04000641f800000000504e182'
>>> metaweb.upload("P2.foo", "text/text", credentials)
{u'status': u'400', u'messages': [u'image/x-portable-graymap is not an
acceptable mime-type.']}
As you can see, content that begins "P1," causes an error. Some other
variants like the last also cause bad behavior. Also, the error JSON
that comes back is formatted in a way that breaks the normal upload
routine, which expects the 'messages' slot to contain a list of dicts.
Chasing this a bit further, it looks like something bad happens (Ajax
hang) if you try to make a topic description that begins "P1," in the
web interface as well.
I guess something is trying to be clever about inferring the content
type from the content. Unfortunately, it's being overly clever in this
case since I actually do have a text string that begins this way!
("P1,P4-bis(5'-Guanosyl) tetraphosphate is an intermediate in the
metabolism of Pyrimidine. It is a substrate for
Bis(5'-nucleosyl)-tetraphosphatase.", if you are curious).
More information about the Developers
mailing list