From c9ae7174771f859e970fd5e7424c228daf6776a1 Mon Sep 17 00:00:00 2001 From: Jeff Reiffers Date: Thu, 31 Oct 2024 08:25:20 +0100 Subject: [PATCH] fix: bad request cannot contain \\n --- static_rdf_server/routes/ontology.py | 2 +- tests/integration/test_put_ontology.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/static_rdf_server/routes/ontology.py b/static_rdf_server/routes/ontology.py index b9f224e..664e98e 100644 --- a/static_rdf_server/routes/ontology.py +++ b/static_rdf_server/routes/ontology.py @@ -144,7 +144,7 @@ async def put_ontology(request: web.Request) -> web.Response: # noqa: C901 ) except NotValidFileContentException as e: raise web.HTTPBadRequest( - reason=f'Ontology file "{part.filename}" has not valid content: {str(e)}.' + reason=f'Ontology file "{part.filename}" has not valid content.' ) from e # For html-files We need to rewrite links to sub-folders: diff --git a/tests/integration/test_put_ontology.py b/tests/integration/test_put_ontology.py index 43e5e3a..c0d060b 100644 --- a/tests/integration/test_put_ontology.py +++ b/tests/integration/test_put_ontology.py @@ -464,7 +464,7 @@ async def test_put_ontology_file_not_readable(client: Any, fs: Any) -> None: assert response.status == 400 body = await response.json() - assert f'Ontology file "{ontology}.ttl" has not valid content:' in body["detail"] + assert f'Ontology file "{ontology}.ttl" has not valid content' in body["detail"] @pytest.mark.integration @@ -544,7 +544,7 @@ async def test_put_ontology_rdf_file_not_parsable(client: Any, fs: Any) -> None: assert response.status == 400 body = await response.json() - assert f'Ontology file "{ontology}.ttl" has not valid content:' in body["detail"] + assert f'Ontology file "{ontology}.ttl" has not valid content' in body["detail"] @pytest.mark.integration