Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle DecompressionBombError when uploading a large image #185

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test_and_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: [3.7, 3.8, 3.9, "3.10"]

steps:
- uses: actions/checkout@v2
Expand All @@ -32,7 +32,7 @@ jobs:
isort .
black .
- name: Report to coverall # by the package as the action is broken, but won't work on external forks!
if: matrix.python-version == 3.7
if: matrix.python-version == 3.7 && github.repository == 'jonasundderwolf/django-image-cropping'
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
run: |
Expand Down
2 changes: 1 addition & 1 deletion example/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-e .
easy_thumbnails==2.8.1
easy_thumbnails==2.8.5
WebTest==3.0.0
django-webtest==1.9.9
coverage==5.5
Expand Down
5 changes: 3 additions & 2 deletions image_cropping/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ def get_attrs(image, name):
try:
# open image and rotate according to its exif.orientation
width, height = get_backend().get_size(image)
except AttributeError:
# invalid image -> AttributeError
except BaseException:
# invalid image -> AttributeError or DecompressionBombError
logger.warning("Error while getting image size", exc_info=True)
width = image.width
height = image.height
return {
Expand Down
12 changes: 6 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@

[tox]
envlist =
py{36,37,38,39}-django22
py{36,37,38,39}-django30
py{36,37,38,39}-django31
py{36,37,38,39}-django32
py{38,39}-django40
py{37,38,39}-django22
py{37,38,39}-django30
py{37,38,39}-django31
py{37,38,39,310}-django32
py{38,39,310}-django40

[gh-actions]
python =
3.6: py36
3.7: py37
3.8: py38
3.9: py39
3.10: py310

[testenv]
commands =
Expand Down
Loading