Skip to content

Fixed #19457 - ImageField size detection fails for some files even when PIL could succeed #586

Closed
wants to merge 1 commit into from

2 participants

@apollo13
Django member

What about the picture license? Are we allowed to include it? If not sure please create your own.

@bak1an
bak1an commented Dec 30, 2012

ok, i will create some random png image with big zTXt section and update pull request

@bak1an
bak1an commented Dec 31, 2012

@apollo13 pull request updated with new image now.
it's generated with this script https://github.com/moljac024/scripts/blob/master/other/konify.pl and contains 10KB from my /dev/urandom within it's metadata. so it's free from any copyrights now.

i also added check to except block to ensure that we are ignoring only "truncated stream" errors and reraise other exceptions from zlib.

@bak1an
bak1an commented Dec 31, 2012

also, i know that checking error code with str.startswith() is at least strange, but it looks like we have no other choice, because zlib does not save it anywhere else and return only formatted string with error description.

http://hg.python.org/cpython/file/f6fb5a5748f0/Modules/zlibmodule.c#l77

or i'm missing something?

@apollo13
Django member
apollo13 commented Jan 1, 2013

Commited, Thx!

@apollo13 apollo13 closed this Jan 1, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.