diff --git a/files/routes/search.py b/files/routes/search.py index d1e808260..fd6318e18 100644 --- a/files/routes/search.py +++ b/files/routes/search.py @@ -85,7 +85,7 @@ def searchposts(v): domain=None, domain_obj=None, error=f"@{author.username}'s profile is private; You can't use the 'author' syntax on them." - ) + ), 403 else: posts = posts.filter(Submission.author_id == author.id) if 'q' in criteria: @@ -199,7 +199,7 @@ def searchcomments(v): if v.client: abort(403, f"@{author.username}'s profile is private; You can't use the 'author' syntax on them") - return render_template("search_comments.html", v=v, query=query, total=0, page=page, comments=[], sort=sort, t=t, next_exists=False, error=f"@{author.username}'s profile is private; You can't use the 'author' syntax on them.") + return render_template("search_comments.html", v=v, query=query, total=0, page=page, comments=[], sort=sort, t=t, next_exists=False, error=f"@{author.username}'s profile is private; You can't use the 'author' syntax on them."), 403 else: comments = comments.filter(Comment.author_id == author.id) diff --git a/files/routes/users.py b/files/routes/users.py index 0f8cc968d..4c5a32f85 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -742,12 +742,12 @@ def u_username_comments(username, v=None): if not u.is_visible_to(v): if g.is_api_or_xhr or request.path.endswith(".json"): abort(403, "This userpage is private") - return render_template("userpage_private.html", u=u, v=v) + return render_template("userpage_private.html", u=u, v=v), 403 if v and hasattr(u, 'is_blocking') and u.is_blocking: if g.is_api_or_xhr or request.path.endswith(".json"): abort(403, f"You are blocking @{u.username}.") - return render_template("userpage_blocking.html", u=u, v=v) + return render_template("userpage_blocking.html", u=u, v=v), 403 try: page = max(int(request.values.get("page", "1")), 1) except: page = 1