From 5e34252cb4b6a124b5323ec06fb6db2df3eefbda Mon Sep 17 00:00:00 2001
From: Inga Kirschnick <inga.kirschnick@uni-bielefeld.de>
Date: Fri, 23 Dec 2022 09:55:46 +0100
Subject: [PATCH] Fix ID/Hashid Problem

---
 app/profile/routes.py                 | 5 ++++-
 app/templates/profile/profile.html.j2 | 2 +-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/app/profile/routes.py b/app/profile/routes.py
index 60eef6ad..bbbf99e6 100644
--- a/app/profile/routes.py
+++ b/app/profile/routes.py
@@ -33,13 +33,16 @@ def profile(user_id):
         abort(403)
     return render_template(
         'profile/profile.html.j2', 
-        user=user.to_json_serializeable()
+        user=user.to_json_serializeable(),
+        user_id=user_id
     )
 
 
 @bp.route('/<hashid:user_id>/avatar')
 def profile_avatar(user_id):
+    print(user_id)
     user = User.query.get_or_404(user_id)
+    print(user)
     if user.avatar is None:
         abort(404)
     if not user.is_public and not (user == current_user or current_user.is_administrator()):
diff --git a/app/templates/profile/profile.html.j2 b/app/templates/profile/profile.html.j2
index 37077ca3..b8c0ad19 100644
--- a/app/templates/profile/profile.html.j2
+++ b/app/templates/profile/profile.html.j2
@@ -13,7 +13,7 @@
                 <br>
                 <br>
                 {% if user.avatar %}
-                <img src="/profile/{{ user.id }}/avatar" alt="user-image" class="circle responsive-img">
+                <img src="{{ url_for('.profile_avatar', user_id=user_id) }}" alt="user-image" class="circle responsive-img">
                 {% else %}
                 <img src="{{ url_for('static', filename='images/user_avatar.png') }}" alt="user-image" class="circle responsive-img">
                 {% endif %}
-- 
GitLab