Skip to content

Commit

Permalink
🪲 Fix error page (#5612)
Browse files Browse the repository at this point in the history
The error page was failing because it was trying to retrieve an image that wasn't there.

Fixes #5598

**How to test**

Follow these steps to verify this PR works as intended:

* Go to http://127.0.0.1:5000/hedy/a24e2453366248fb9359fffa3089d209/view whilst logged out and see that the image and the message is shown.
  • Loading branch information
jpelay authored Jun 14, 2024
1 parent f37a384 commit b21df61
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion templates/error-page.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{% block regular_content %}
<div class="flex flex-col items-center">
<div class="w-1/2 mt-8">
<img class="w-full" src="/images/{{ error }}.png" alt="{{_('error_logo_alt')}}">
<img class="w-full" src="/images/{{ error_image }}.png" alt="{{_('error_logo_alt')}}">
</div>
<div class="mb-6 -mt-8 text-lg font-bold">
{{page_error}}
Expand Down
6 changes: 4 additions & 2 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,10 @@ def error_page(error=404, page_error=None, ui_message=None, menu=True, iframe=No
if error not in [400, 403, 404, 500, 401]:
error = 404
default = gettext('default_404')
error_image = error
if error == 401:
default = gettext('default_401')
error_image = 403
if error == 403:
default = gettext('default_403')
elif error == 500:
Expand All @@ -347,8 +349,8 @@ def error_page(error=404, page_error=None, ui_message=None, menu=True, iframe=No
"error": default,
"exception": traceback.format_exception(type(exception), exception, exception.__traceback__) if exception else None}, error)

return render_template("error-page.html", menu=menu, error=error, iframe=iframe,
page_error=page_error or ui_message or '', default=default), error
return render_template("error-page.html", menu=menu, error_image=error_image, iframe=iframe,
page_error=page_error or ui_message or default or '', default=default), error


def session_id():
Expand Down

0 comments on commit b21df61

Please sign in to comment.