fix: Verify legacy API redirects exist
All checks were successful
Build Docker / BuildImage (push) Successful in 54s
All checks were successful
Build Docker / BuildImage (push) Successful in 54s
This fixes an infinite redirect loop
This commit is contained in:
@@ -205,8 +205,11 @@ def links_get():
|
|||||||
@app.route("/api/<path:function>")
|
@app.route("/api/<path:function>")
|
||||||
def api_legacy_get(function):
|
def api_legacy_get(function):
|
||||||
# Check if function is in api blueprint
|
# Check if function is in api blueprint
|
||||||
|
for rule in app.url_map.iter_rules():
|
||||||
|
# Check if the redirect route exists
|
||||||
|
if rule.rule == f"/api/v1/{function}":
|
||||||
return redirect(f"/api/v1/{function}", code=301)
|
return redirect(f"/api/v1/{function}", code=301)
|
||||||
|
return error_response(request, message="404 Not Found", code=404)
|
||||||
|
|
||||||
|
|
||||||
@app.route("/actions.json")
|
@app.route("/actions.json")
|
||||||
|
|||||||
Reference in New Issue
Block a user