Tomi Hiltunen

Enthusiastic app developer in Google Go & HTML5

maanantai 18. maaliskuuta 2013

Heads up with GAE blobstore!

The problem

I recently ran into problems with Google App Engine blobstore. My HTML5 page had a multipart form for creating content on my app. The form included various inputs for name, coordinates and also a file input for a photo. The form was posted to the blobstore generated upload URL... and it crashed.

After experimenting a bit with my code I narrowed down the cause to be with blobstore's method ParseUploads(). The problem exists only when at least one of the text inputs contained a value with non-ascii characters such as the scandinavian "ö".

I ran a search on Google App Engine's issue tracker on "blobstore go" and found out that it is an actual reported bug in the environment.

The same problem does not exist when there is no non-ascii characters in the inputs. The problem does not exist either with regular form uploads (without file inputs) read with r.FormValue("...").

The solution (for now)

I went around the problem by separating the photo uploads from the other data. My form now does not include a file input. I replaced that with a button connected to the Plupload JavaScript plugin. The upload is handled by a separate handler and the form posts only the text inputs to another handler.

Now my content can have the photos added and names/descriptions can contain non-ascii characters. This satisfies my need for now!

Ei kommentteja:

Lähetä kommentti