Fix ID/Hashid Problem

This commit is contained in:
Inga Kirschnick 2022-12-23 09:55:46 +01:00
parent e633b834c6
commit 5e34252cb4
2 changed files with 5 additions and 2 deletions

View File

@ -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()):

View File

@ -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 %}