mirror of
https://github.com/the1024club/the1024.club.git
synced 2026-01-24 12:20:19 +00:00
Move user location code outside of GET handler for /<fingerprint>
Technically, all of the operations available via /<fingerprint> will access the user object in some fashion, so loading of the user object can be done outside of the GET if-block.
This commit is contained in:
@@ -72,9 +72,9 @@ def register():
|
||||
|
||||
@app.route("/<fingerprint>", methods=["GET", "UPDATE", "DELETE"])
|
||||
def render_data(fingerprint):
|
||||
if request.method == "GET":
|
||||
user = User.query.filter_by(fingerprint=fingerprint).first()
|
||||
if not user: return abort(404)
|
||||
if request.method == "GET":
|
||||
resp = make_response(user.data or b"", 200)
|
||||
resp.headers["Content-Type"] = user.mime_type
|
||||
return resp
|
||||
|
||||
Reference in New Issue
Block a user