mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-03 19:57:29 +01:00
Fix endpoint argument rename causing issues
This commit is contained in:
parent
45ed12ddf0
commit
f2eee008f6
@ -285,8 +285,8 @@ def create_release(token, package):
|
|||||||
@bp.route("/api/packages/<author>/<name>/releases/<int:id>/")
|
@bp.route("/api/packages/<author>/<name>/releases/<int:id>/")
|
||||||
@is_package_page
|
@is_package_page
|
||||||
@cors_allowed
|
@cors_allowed
|
||||||
def release_view(package: Package, id_: int):
|
def release_view(package: Package, id: int):
|
||||||
release = PackageRelease.query.get(id_)
|
release = PackageRelease.query.get(id)
|
||||||
if release is None or release.package != package:
|
if release is None or release.package != package:
|
||||||
error(404, "Release not found")
|
error(404, "Release not found")
|
||||||
|
|
||||||
@ -298,8 +298,8 @@ def release_view(package: Package, id_: int):
|
|||||||
@is_package_page
|
@is_package_page
|
||||||
@is_api_authd
|
@is_api_authd
|
||||||
@cors_allowed
|
@cors_allowed
|
||||||
def delete_release(token: APIToken, package: Package, id_: int):
|
def delete_release(token: APIToken, package: Package, id: int):
|
||||||
release = PackageRelease.query.get(id_)
|
release = PackageRelease.query.get(id)
|
||||||
if release is None or release.package != package:
|
if release is None or release.package != package:
|
||||||
error(404, "Release not found")
|
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>/")
|
@bp.route("/api/packages/<author>/<name>/screenshots/<int:id>/")
|
||||||
@is_package_page
|
@is_package_page
|
||||||
@cors_allowed
|
@cors_allowed
|
||||||
def screenshot(package, id_):
|
def screenshot(package, id):
|
||||||
ss = PackageScreenshot.query.get(id_)
|
ss = PackageScreenshot.query.get(id)
|
||||||
if ss is None or ss.package != package:
|
if ss is None or ss.package != package:
|
||||||
error(404, "Screenshot not found")
|
error(404, "Screenshot not found")
|
||||||
|
|
||||||
@ -365,8 +365,8 @@ def screenshot(package, id_):
|
|||||||
@is_package_page
|
@is_package_page
|
||||||
@is_api_authd
|
@is_api_authd
|
||||||
@cors_allowed
|
@cors_allowed
|
||||||
def delete_screenshot(token: APIToken, package: Package, id_: int):
|
def delete_screenshot(token: APIToken, package: Package, id: int):
|
||||||
ss = PackageScreenshot.query.get(id_)
|
ss = PackageScreenshot.query.get(id)
|
||||||
if ss is None or ss.package != package:
|
if ss is None or ss.package != package:
|
||||||
error(404, "Screenshot not found")
|
error(404, "Screenshot not found")
|
||||||
|
|
||||||
|
@ -60,8 +60,8 @@ def list_all():
|
|||||||
|
|
||||||
@bp.route("/threads/<int:id>/subscribe/", methods=["POST"])
|
@bp.route("/threads/<int:id>/subscribe/", methods=["POST"])
|
||||||
@login_required
|
@login_required
|
||||||
def subscribe(id_):
|
def subscribe(id):
|
||||||
thread = Thread.query.get(id_)
|
thread = Thread.query.get(id)
|
||||||
if thread is None or not thread.check_perm(current_user, Permission.SEE_THREAD):
|
if thread is None or not thread.check_perm(current_user, Permission.SEE_THREAD):
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
@ -77,8 +77,8 @@ def subscribe(id_):
|
|||||||
|
|
||||||
@bp.route("/threads/<int:id>/unsubscribe/", methods=["POST"])
|
@bp.route("/threads/<int:id>/unsubscribe/", methods=["POST"])
|
||||||
@login_required
|
@login_required
|
||||||
def unsubscribe(id_):
|
def unsubscribe(id):
|
||||||
thread = Thread.query.get(id_)
|
thread = Thread.query.get(id)
|
||||||
if thread is None or not thread.check_perm(current_user, Permission.SEE_THREAD):
|
if thread is None or not thread.check_perm(current_user, Permission.SEE_THREAD):
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
@ -94,8 +94,8 @@ def unsubscribe(id_):
|
|||||||
|
|
||||||
@bp.route("/threads/<int:id>/set-lock/", methods=["POST"])
|
@bp.route("/threads/<int:id>/set-lock/", methods=["POST"])
|
||||||
@login_required
|
@login_required
|
||||||
def set_lock(id_):
|
def set_lock(id):
|
||||||
thread = Thread.query.get(id_)
|
thread = Thread.query.get(id)
|
||||||
if thread is None or not thread.check_perm(current_user, Permission.LOCK_THREAD):
|
if thread is None or not thread.check_perm(current_user, Permission.LOCK_THREAD):
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
@ -120,8 +120,8 @@ def set_lock(id_):
|
|||||||
|
|
||||||
@bp.route("/threads/<int:id>/delete/", methods=["GET", "POST"])
|
@bp.route("/threads/<int:id>/delete/", methods=["GET", "POST"])
|
||||||
@login_required
|
@login_required
|
||||||
def delete_thread(id_):
|
def delete_thread(id):
|
||||||
thread = Thread.query.get(id_)
|
thread = Thread.query.get(id)
|
||||||
if thread is None or not thread.check_perm(current_user, Permission.DELETE_THREAD):
|
if thread is None or not thread.check_perm(current_user, Permission.DELETE_THREAD):
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
@ -143,8 +143,8 @@ def delete_thread(id_):
|
|||||||
|
|
||||||
@bp.route("/threads/<int:id>/delete-reply/", methods=["GET", "POST"])
|
@bp.route("/threads/<int:id>/delete-reply/", methods=["GET", "POST"])
|
||||||
@login_required
|
@login_required
|
||||||
def delete_reply(id_):
|
def delete_reply(id):
|
||||||
thread = Thread.query.get(id_)
|
thread = Thread.query.get(id)
|
||||||
if thread is None:
|
if thread is None:
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
@ -182,8 +182,8 @@ class CommentForm(FlaskForm):
|
|||||||
|
|
||||||
@bp.route("/threads/<int:id>/edit/", methods=["GET", "POST"])
|
@bp.route("/threads/<int:id>/edit/", methods=["GET", "POST"])
|
||||||
@login_required
|
@login_required
|
||||||
def edit_reply(id_):
|
def edit_reply(id):
|
||||||
thread = Thread.query.get(id_)
|
thread = Thread.query.get(id)
|
||||||
if thread is None:
|
if thread is None:
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
@ -219,8 +219,8 @@ def edit_reply(id_):
|
|||||||
|
|
||||||
|
|
||||||
@bp.route("/threads/<int:id>/", methods=["GET", "POST"])
|
@bp.route("/threads/<int:id>/", methods=["GET", "POST"])
|
||||||
def view(id_):
|
def view(id):
|
||||||
thread: Thread = Thread.query.get(id_)
|
thread: Thread = Thread.query.get(id)
|
||||||
if thread is None or not thread.check_perm(current_user, Permission.SEE_THREAD):
|
if thread is None or not thread.check_perm(current_user, Permission.SEE_THREAD):
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
|
@ -52,14 +52,14 @@ def zipgrep_search():
|
|||||||
|
|
||||||
|
|
||||||
@bp.route("/zipgrep/<id>/")
|
@bp.route("/zipgrep/<id>/")
|
||||||
def view_results(id_):
|
def view_results(id):
|
||||||
result = celery.AsyncResult(id_)
|
result = celery.AsyncResult(id)
|
||||||
if result.status == "PENDING":
|
if result.status == "PENDING":
|
||||||
abort(404)
|
abort(404)
|
||||||
|
|
||||||
if result.status != "SUCCESS" or isinstance(result.result, Exception):
|
if result.status != "SUCCESS" or isinstance(result.result, Exception):
|
||||||
result_url = url_for("zipgrep.view_results", id=id_)
|
result_url = url_for("zipgrep.view_results", id=id)
|
||||||
return redirect(url_for("tasks.check", id=id_, r=result_url))
|
return redirect(url_for("tasks.check", id=id, r=result_url))
|
||||||
|
|
||||||
matches = result.result["matches"]
|
matches = result.result["matches"]
|
||||||
for match in matches:
|
for match in matches:
|
||||||
|
Loading…
Reference in New Issue
Block a user