sachet/server/files/views.py: add check for invalid UUID
This commit is contained in:
parent
45018511f7
commit
387e2dbeb9
@ -27,6 +27,13 @@ class FilesMetadataAPI(ModelAPI):
|
|||||||
|
|
||||||
@auth_required(required_permissions=(Permissions.DELETE,))
|
@auth_required(required_permissions=(Permissions.DELETE,))
|
||||||
def delete(self, share_id, auth_user=None):
|
def delete(self, share_id, auth_user=None):
|
||||||
|
try:
|
||||||
|
uuid.UUID(share_id)
|
||||||
|
except ValueError:
|
||||||
|
return jsonify(dict(
|
||||||
|
status="fail",
|
||||||
|
message=f"Invalid ID: '{share_id}'."
|
||||||
|
))
|
||||||
share = Share.query.filter_by(share_id=share_id).first()
|
share = Share.query.filter_by(share_id=share_id).first()
|
||||||
return super().delete(share)
|
return super().delete(share)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user