mozilla/openbadges — pull request #969 by brianloveswords (2013-12-03 19:45:06+00:00)
Title: Convert images back to base64 before reinserting them.

When I wrote the code to bake images as they came out of the database, I forgot to re-encode them as base64 before putting them back into the database.

I wrote an automated test, but I also did some manual testing by doing some database surgery:

1. Hit `demo/ballertime`
2. Get base64 for an unbaked badge (on OS X, `base64 < static/_demo/zero.large.png | pbcopy`)
3. Replace one of the badge images in the database with the unbaked base64 data, flip `baked` bit to 0.
4. Hard-refresh the page and see if the badge image shows up
5. For extra credit, examine the database and ensure the image data is actually different: copy the base64 data from the databse, then `pbpaste | base64 -D | diff static/_demo/zero.large.png -`