Skip to content

Commit

Permalink
Force return after 404
Browse files Browse the repository at this point in the history
  • Loading branch information
cavenel committed Dec 4, 2023
1 parent 4095370 commit 3f7d74b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tissuumaps/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -729,16 +729,19 @@ def tile_asso(path, associated_name, level, col, row, format):
if not completePath.startswith(app.basedir):
# Directory traversal
abort(404)
return
slide = _get_slide(completePath).associated_images[associated_name]
format = format.lower()
if format != "jpeg" and format != "png":
# Not supported by Deep Zoom
abort(404)
return
try:
tile = slide.get_tile(level, (col, row))
except ValueError:
# Invalid level or coordinates
abort(404)
return
buf = PILBytesIO()
tile.save(buf, format, quality=app.config["DEEPZOOM_TILE_QUALITY"])
resp = make_response(buf.getvalue())
Expand Down

0 comments on commit 3f7d74b

Please sign in to comment.