Skip to content

Commit

Permalink
merge: #197 from dev
Browse files Browse the repository at this point in the history
  • Loading branch information
alycejenni authored Jul 30, 2024
2 parents 6779832 + 4250624 commit 0c1059d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ coverage
web/scss/.sass-cache/

api/thumbnails/
api/logs/

build/

Expand Down
10 changes: 7 additions & 3 deletions api/phenome10k/routes/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from flask import Blueprint, redirect, url_for, send_file
from flask import Response, current_app, send_from_directory
from flask import request
from flask.helpers import safe_join
from werkzeug.exceptions import NotFound, BadRequest
from werkzeug.utils import safe_join

from ._decorators import login_required, requires_contributor
from ._utils import ensure_editable
Expand Down Expand Up @@ -106,8 +106,12 @@ def send_uploads(path):
except FileExistsError:
pass

height = im.height * width / im.width
im.thumbnail((width, height))
height = im.height * width // im.width
try:
im.thumbnail((width, height))
except OSError:
# if this didn't work, the image is broken
raise NotFound()
byte_io = io.BytesIO()
im.save(byte_io, format='PNG')
im.save(thumbnail_file, format='PNG')
Expand Down
2 changes: 0 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3'

services:
data:
image: mariadb:jammy
Expand Down

0 comments on commit 0c1059d

Please sign in to comment.