Skip to content

ech00147 export can't deal with keywords with leading/trailing whitespace #6311

@deiferni

Description

@deiferni

https://sentry.4teamwork.ch/sentry/onegov-gever/issues/63411/

steps to reproduce:

  • Create a keyword with trailing whitespace e.g. via PATCH request with the following body to a document or dossier:
{
  "keywords": [
    {
      "title": "niuu ",
      "token": "niuu "
    }
  ]
}
  • run an ech00147 export for the dossier. the export will fail with the following error:
SimpleTypeValueError: Type {http://www.w3.org/2001/XMLSchema}token cannot be created from {http://www.w3.org/2001/XMLSchema}token: SCHLAGWORT: 20016_TEST_WEHRLE_001 
(21 additional frame(s) were not displayed)
...
  File "pyxb/binding/basis.py", line 943, in __init__
    self.xsdConstraintsOK(location)
  File "pyxb/binding/basis.py", line 1069, in xsdConstraintsOK
    return self.XsdConstraintsOK(self, location)
  File "pyxb/binding/basis.py", line 1035, in XsdConstraintsOK
    value = cls._XsdConstraintsPreCheck_vb(value)
  File "pyxb/binding/datatypes.py", line 1061, in _XsdConstraintsPreCheck_vb
    if not cls._ValidateString_va(value):
  File "pyxb/binding/datatypes.py", line 1086, in _ValidateString_va
    raise SimpleTypeValueError(cls, value)

SimpleTypeValueError: Type {http://www.w3.org/2001/XMLSchema}token cannot be created from {http://www.w3.org/2001/XMLSchema}token: SCHLAGWORT: 20016_TEST_WEHRLE_001 

We should either fix the ech00147 export or disallow creating keywords with trailing whitespace. Also as this seems to have been in production for a while we must provide a cleanup upgrade to remove keywords with trailing/leading whitespace and potentially merge keywords.

See also #6312 for the sibling issue describing the restapi input sanitation we should discuss. If we fix the api, this issue here can be closed.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions