Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
deiferni opened this issue Mar 9, 2020 · 0 comments
Open

Comments

@deiferni
Copy link
Contributor

deiferni commented Mar 9, 2020

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.

@deiferni deiferni changed the title ech00147 export can't deal with keywords with trailing whitespace ech00147 export can't deal with keywords with leading/trailing whitespace Mar 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant