SmileyChris / easy-thumbnails

Easy thumbnails for Django
http://easy-thumbnails.readthedocs.org/
BSD 3-Clause "New" or "Revised" License
1.37k stars 312 forks source link

Bug in version 2.7.1 #563

Closed pyanchesko closed 2 years ago

pyanchesko commented 3 years ago

Hi! After upgrading to version 2.7.1, I started getting the error: ValueError: Operation on closed image error.

I think that reason is the image file is now closing by the context manager. But it shouldn't. I suggest to return to the previous version this block of code.

2.7.0 (previous version) https://github.com/SmileyChris/easy-thumbnails/blob/2.7.0/easy_thumbnails/source_generators.py#L25-L31

2.7.1 (current version) https://github.com/SmileyChris/easy-thumbnails/blob/2.7.1/easy_thumbnails/source_generators.py#L25-L31

my pr: #564

jrief commented 3 years ago

@Mogost This regression apparently has been added in commit 2abd400c8e005045591eb1003d1dcbc0602923c5. In your opinion, can we revert it?

pyanchesko commented 3 years ago

I don't think it's worth it. Because this commit also contains good changes

Mogost commented 3 years ago

@pyanchesko What version of pillow do you use?

@jrief I think that we shouldn't do a revert, it's better to understand bug and fix it.

@pyanchesko can you write a test that will reprduce this situation?

cc: @SmileyChris

SebCorbin commented 3 years ago

I reverted to 2.7.0 for the time being, because it's causing errors on project in production.

In the meantime this has been addressed in Django core :

I hope this clarification is enough to understand the bug, I could work on that if you give me directions