mirror of
https://github.com/the1024club/the1024.club.git
synced 2026-11-07 22:45:39 +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:
1 parent
26a92162dc
commit
d3730aa6cd
1 file changed
+1
-1
@@ -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