{"push_id":625139098,"size":3,"distinct_size":1,"ref":"refs/heads/master","head":"49330a5a66e5e3829f4fa84c22efdb779ce6b09d","before":"c7d8ebf03ebb8bce8f2c6aaf173afab734843acb","commits":[{"sha":"efbbf4e089ecbfa3c322a262820c7caa660c7f4a","author":{"email":"7ece978167073d004197c0d6655799d1a2ce976e@pobox.com","name":"Mark Longair"},"message":"Guess the MIME type of an uploaded image if it wasn't specified\n\nIf mime_type isn't set on an image object stored by PopIt then it\nwill currently be returned with \"Content-Type: undefined\"; to avoid\nthis, which the image proxy won't cope with.\n\nThis commit introduces code that infers the file's MIME type using\nmmmagic (a node wrapper for libmagic) and sets mime_type on the image\nobject to that value.","distinct":false,"url":"https://api.github.com/repos/mysociety/popit-api/commits/efbbf4e089ecbfa3c322a262820c7caa660c7f4a"},{"sha":"c170743da288526c4eed2695b81a8af2e24f5639","author":{"email":"7ece978167073d004197c0d6655799d1a2ce976e@pobox.com","name":"Mark Longair"},"message":"Disallow non-image uploads & ignore the supplied mime_type\n\nIt seems unnecessary to trust the user of the API to get the MIME type\nof an uploaded image correct, when we can infer the file type using\nlibmagic. (And this saves documenting the mime_type parameter...)\n\nSince libmagic just looks for invariant magic numbers at fixed offsets\ninto binary files (to paraphrase the man page), it can't tell whether\na file is malformed (possibly maliciously), but this was a risk with\nthe existing code anyway, and if a browser or image library is subject\nto buffer overruns or the like that's a much more serious problem than\njust that PopIt might store and serve such a file.\n\nIn addition this makes sure that newly uploaded files will only be\nserved with an image/* Content-Type.  (Existing uploaded images will\nstill be served with whatever mime_type was specified on upload.)\n\nFixes mysociety/popit#810","distinct":false,"url":"https://api.github.com/repos/mysociety/popit-api/commits/c170743da288526c4eed2695b81a8af2e24f5639"},{"sha":"49330a5a66e5e3829f4fa84c22efdb779ce6b09d","author":{"email":"1559339698d4b91062141e6c67af7c94ca1d6f09@mysociety.org","name":"Chris Mytton"},"message":"Merge branch 'image-mime-type-fixes'","distinct":true,"url":"https://api.github.com/repos/mysociety/popit-api/commits/49330a5a66e5e3829f4fa84c22efdb779ce6b09d"}]}