Fix endpoint argument rename causing issues

This commit is contained in:
rubenwardy 2023-06-19 22:10:21 +01:00
parent 45ed12ddf0
commit f2eee008f6
3 changed files with 26 additions and 26 deletions

@ -285,8 +285,8 @@ def create_release(token, package):
@bp.route("/api/packages/<author>/<name>/releases/<int:id>/")
@is_package_page
@cors_allowed
def release_view(package: Package, id_: int):
release = PackageRelease.query.get(id_)
def release_view(package: Package, id: int):
release = PackageRelease.query.get(id)
if release is None or release.package != package:
error(404, "Release not found")
@ -298,8 +298,8 @@ def release_view(package: Package, id_: int):
@is_package_page
@is_api_authd
@cors_allowed
def delete_release(token: APIToken, package: Package, id_: int):
release = PackageRelease.query.get(id_)
def delete_release(token: APIToken, package: Package, id: int):
release = PackageRelease.query.get(id)
if release is None or release.package != package:
error(404, "Release not found")
@ -352,8 +352,8 @@ def create_screenshot(token: APIToken, package: Package):
@bp.route("/api/packages/<author>/<name>/screenshots/<int:id>/")
@is_package_page
@cors_allowed
def screenshot(package, id_):
ss = PackageScreenshot.query.get(id_)
def screenshot(package, id):
ss = PackageScreenshot.query.get(id)
if ss is None or ss.package != package:
error(404, "Screenshot not found")
@ -365,8 +365,8 @@ def screenshot(package, id_):
@is_package_page
@is_api_authd
@cors_allowed
def delete_screenshot(token: APIToken, package: Package, id_: int):
ss = PackageScreenshot.query.get(id_)
def delete_screenshot(token: APIToken, package: Package, id: int):
ss = PackageScreenshot.query.get(id)
if ss is None or ss.package != package:
error(404, "Screenshot not found")

@ -60,8 +60,8 @@ def list_all():
@bp.route("/threads/<int:id>/subscribe/", methods=["POST"])
@login_required
def subscribe(id_):
thread = Thread.query.get(id_)
def subscribe(id):
thread = Thread.query.get(id)
if thread is None or not thread.check_perm(current_user, Permission.SEE_THREAD):
abort(404)
@ -77,8 +77,8 @@ def subscribe(id_):
@bp.route("/threads/<int:id>/unsubscribe/", methods=["POST"])
@login_required
def unsubscribe(id_):
thread = Thread.query.get(id_)
def unsubscribe(id):
thread = Thread.query.get(id)
if thread is None or not thread.check_perm(current_user, Permission.SEE_THREAD):
abort(404)
@ -94,8 +94,8 @@ def unsubscribe(id_):
@bp.route("/threads/<int:id>/set-lock/", methods=["POST"])
@login_required
def set_lock(id_):
thread = Thread.query.get(id_)
def set_lock(id):
thread = Thread.query.get(id)
if thread is None or not thread.check_perm(current_user, Permission.LOCK_THREAD):
abort(404)
@ -120,8 +120,8 @@ def set_lock(id_):
@bp.route("/threads/<int:id>/delete/", methods=["GET", "POST"])
@login_required
def delete_thread(id_):
thread = Thread.query.get(id_)
def delete_thread(id):
thread = Thread.query.get(id)
if thread is None or not thread.check_perm(current_user, Permission.DELETE_THREAD):
abort(404)
@ -143,8 +143,8 @@ def delete_thread(id_):
@bp.route("/threads/<int:id>/delete-reply/", methods=["GET", "POST"])
@login_required
def delete_reply(id_):
thread = Thread.query.get(id_)
def delete_reply(id):
thread = Thread.query.get(id)
if thread is None:
abort(404)
@ -182,8 +182,8 @@ class CommentForm(FlaskForm):
@bp.route("/threads/<int:id>/edit/", methods=["GET", "POST"])
@login_required
def edit_reply(id_):
thread = Thread.query.get(id_)
def edit_reply(id):
thread = Thread.query.get(id)
if thread is None:
abort(404)
@ -219,8 +219,8 @@ def edit_reply(id_):
@bp.route("/threads/<int:id>/", methods=["GET", "POST"])
def view(id_):
thread: Thread = Thread.query.get(id_)
def view(id):
thread: Thread = Thread.query.get(id)
if thread is None or not thread.check_perm(current_user, Permission.SEE_THREAD):
abort(404)

@ -52,14 +52,14 @@ def zipgrep_search():
@bp.route("/zipgrep/<id>/")
def view_results(id_):
result = celery.AsyncResult(id_)
def view_results(id):
result = celery.AsyncResult(id)
if result.status == "PENDING":
abort(404)
if result.status != "SUCCESS" or isinstance(result.result, Exception):
result_url = url_for("zipgrep.view_results", id=id_)
return redirect(url_for("tasks.check", id=id_, r=result_url))
result_url = url_for("zipgrep.view_results", id=id)
return redirect(url_for("tasks.check", id=id, r=result_url))
matches = result.result["matches"]
for match in matches: