Skip to content

Commit 3205fc1

Browse files
author
Felipe Vicens
committed
Validating GET user_uuid
1 parent 8b2ad52 commit 3205fc1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

son-gtklic/routes/licenses.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,13 @@ class LicensesList(Resource):
1414

1515
def get(self):
1616
if 'user_uuid' in request.args:
17-
licenses = License.query.filter(user_uuid=request.args.get('user_uuid')).all()
17+
try:
18+
user_uuid = request.args.get('user_uuid')
19+
UUID(user_uuid)
20+
except:
21+
self.log_bad_request()
22+
return build_response(status_code=400, error="Invalid field", description="user_uuid is not valid")
23+
licenses = License.query.filter_by(user_uuid=user_uuid).all()
1824
else:
1925
licenses = License.query.all()
2026

0 commit comments

Comments
 (0)