uwazi
uwazi copied to clipboard
(Apparently) DocumentTypeList generates a query with empty Q
Describe the bug We have many errors (mostly on serverside rendering) that Q reaches with an empty value. This is giving a type error. The cause is not really clear, please debug. The error could be in other places as well, but the notifications seem to point to DocumentTypeList.
Related to #5318
I'm re-labeling this to frontend since rison is not used outside the client. That also means that we are getting the errors on the server only when it's server-side rendered, but this could happen in the client as well. DocumentTypeList is failing on empty q because it does not try-catch the rison.decode. Some other parts of the code does, for example, the library's RouteHandler::requestState. Nevertheless, keep in mind the q parameter comes directly from the url, so the errors we got are to me most likely coming from bad requests from outside of the client (e.g. a search engine crawler). IMHO there's no point in investing time trying to find out if there's code doing requests with empty q. If there was we would have a bug because that functionality would be broken. I think this is an input validation problem, as mentioned in the related issue #5318, and this one should be closed in favor of the other.
cc @RafaPolit @daneryl