Add unit tests for LoginButton component with comprehensive coverage
All checks were successful
Gitea Actions Demo / build-and-push (push) Successful in 46s
All checks were successful
Gitea Actions Demo / build-and-push (push) Successful in 46s
This commit is contained in:
@@ -101,7 +101,10 @@ def request_image(id):
|
||||
if image.user_id is not None and image.user_id != user_id:
|
||||
return jsonify({'error': 'Forbidden: image does not belong to user', 'code': 'FORBIDDEN'}), 403
|
||||
filename = f"{image.id}{image.extension}"
|
||||
filepath = os.path.abspath(os.path.join(get_user_image_dir(image.user_id or user_id), filename))
|
||||
if image.user_id is None:
|
||||
filepath = os.path.abspath(os.path.join(get_user_image_dir("default"), filename))
|
||||
else:
|
||||
filepath = os.path.abspath(os.path.join(get_user_image_dir(image.user_id), filename))
|
||||
if not os.path.exists(filepath):
|
||||
return jsonify({'error': 'File not found'}), 404
|
||||
return send_file(filepath)
|
||||
|
||||
Reference in New Issue
Block a user