diff --git a/abrechnung/application/transactions.py b/abrechnung/application/transactions.py index a5350d03..719154c8 100644 --- a/abrechnung/application/transactions.py +++ b/abrechnung/application/transactions.py @@ -154,7 +154,6 @@ async def _add_file_to_revision( async def _update_file_in_revision( *, conn: Connection, revision_id: int, transaction_id: int, attachment: UpdateFile ) -> int: - if "." in attachment.filename: raise InvalidCommand(f"Dots '.' are not allowed in file names") diff --git a/abrechnung/http/routers/websocket.py b/abrechnung/http/routers/websocket.py index 98ec8b43..f4f4b541 100644 --- a/abrechnung/http/routers/websocket.py +++ b/abrechnung/http/routers/websocket.py @@ -5,7 +5,6 @@ from typing import Optional import asyncpg -import schema from fastapi import APIRouter, Request, WebSocket, WebSocketException, status from abrechnung.application.users import UserService @@ -17,48 +16,6 @@ tags=["websocket"], ) -CLIENT_SCHEMA = schema.Schema( - schema.Or( - { - "type": "subscribe", - "token": str, - "data": {"subscription_type": str, "element_id": int}, - }, - { - "type": "unsubscribe", - "token": str, - "data": {"subscription_type": str, "element_id": int}, - }, - ) -) - -SERVER_SCHEMA = schema.Schema( - schema.Or( - {"type": "error", "data": {"code": int, "msg": str}}, - { - "type": "notification", - "data": { - "subscription_type": str, - "element_id": int, - }, - }, - { - "type": "subscribe_success", - "data": { - "subscription_type": str, - "element_id": int, - }, - }, - { - "type": "unsubscribe_success", - "data": { - "subscription_type": str, - "element_id": int, - }, - }, - ) -) - def make_error_msg(code: int, msg: str) -> dict: return {"type": "error", "data": {"code": code, "msg": msg}} @@ -202,14 +159,10 @@ async def websocket_endpoint( try: while True: msg = await ws.receive_json() - CLIENT_SCHEMA.validate(msg) try: async with db_pool.acquire() as connection: response = await ws_message(connection, connection_id, msg, user_service) - except ( - asyncpg.DataError, - schema.SchemaError, - ) as exc: + except asyncpg.DataError as exc: response = make_error_msg(code=status.HTTP_400_BAD_REQUEST, msg=str(exc)) except Exception as exc: traceback.print_exc()