sachet/server/files/views.py: add check for invalid UUID

This commit is contained in:
dogeystamp 2023-04-26 20:40:45 -04:00
parent 45018511f7
commit 387e2dbeb9
Signed by: dogeystamp
GPG Key ID: 7225FE3592EFFA38

View File

@ -27,6 +27,13 @@ class FilesMetadataAPI(ModelAPI):
@auth_required(required_permissions=(Permissions.DELETE,))
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()
return super().delete(share)