Skip to content

Non UTF-8 encoding throws a 500 Internal Server Error #51

Description

@shabani1

We're not checking content encoding, which can lead to a 500. Here's the simplest way to reproduce.

from lexy_py import LexyClient

lx = LexyClient()
lx.add_documents([
    {'content': '\x00'}
])

On the client, this results in LexyAPIError: 500 Internal Server Error. On the server, it results in the following:

sqlalchemy.exc.DBAPIError: (sqlalchemy.dialects.postgresql.asyncpg.Error) 
<class 'asyncpg.exceptions.CharacterNotInRepertoireError'>: invalid byte sequence for encoding "UTF8": 0x00
(Background on this error at: https://sqlalche.me/e/14/dbapi)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions