diff options
author | Daniel Schadt <kingdread@gmx.de> | 2022-07-23 16:58:56 +0200 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2022-07-23 16:58:56 +0200 |
commit | b90df4386327221dbf14acdddd2ca9706f0cdb41 (patch) | |
tree | e9189561b1c18c7211d0c4cdf8e8034d0195bda8 | |
parent | b07f07c96f88c5e9be9aaf05feed8ef790076482 (diff) | |
download | fietsboek-b90df4386327221dbf14acdddd2ca9706f0cdb41.tar.gz fietsboek-b90df4386327221dbf14acdddd2ca9706f0cdb41.tar.bz2 fietsboek-b90df4386327221dbf14acdddd2ca9706f0cdb41.zip |
stringify path before passing it to FileResponse
Depending on the Python version, this might raise an error: Before 3.8,
mimetypes.guess_type could not deal with a pathlib.Path, and only
accepted a string. guess_type is called internally by FileResponse, so
to make sure we don't run into errors, we stringify the path before
passing it to FileResponse.
-rw-r--r-- | fietsboek/views/detail.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fietsboek/views/detail.py b/fietsboek/views/detail.py index 34d392b..80d112b 100644 --- a/fietsboek/views/detail.py +++ b/fietsboek/views/detail.py @@ -119,7 +119,7 @@ def image(request): except FileNotFoundError: return HTTPNotFound() else: - return FileResponse(image_path, request) + return FileResponse(str(image_path), request) @view_config(route_name="add-comment", request_method="POST", permission="track.comment") |