You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
During the py3 upgrade of ckanext-dcat_usmetadata, a call to usmetadata was made passing a null object into one of the regex validators. The error happened on PY2+CKAN2.8, but I don't think that this is version specific, the same behavior would happen on PY3+CKAN2.9.
This error was hit by running the tests on ckanext-dcat_usmetadata, but because of the py3 upgrade surrounding the extension, I'm not sure the tests can run in a reproducible way right now. To illustrate the issue, the following snippet was run,
$ python
Python 2.7.18 (default, Mar 8 2021, 13:02:45)
[GCC 9.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> validator = re.compile(r'^\d{3}:\d{2}(\s*,\s*\d{3}:\d{2}\s*)*$')
>>> regex_candidate = None
>>> isinstance(validator.match(regex_candidate), type(re.match("", "")))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: expected string or buffer
>>> regex_candidate = ""
>>> isinstance(validator.match(regex_candidate), type(re.match("", "")))
False
>>>
Expected behavior
We would expect that the extension would give a normal validation error. If the parameter was missing, it would give no error, but if the parameter is of the wrong type, it should probably fail with a 'wrong type' error.
Actual behavior
The code exited with a runtime TypeError.
Sketch
Update the validation functions in ckanext/usmetadata/plugin/helper.py to at least check that the input is a str before running the regex validators.
The text was updated successfully, but these errors were encountered:
During the py3 upgrade of ckanext-dcat_usmetadata, a call to usmetadata was made passing a null object into one of the regex validators. The error happened on PY2+CKAN2.8, but I don't think that this is version specific, the same behavior would happen on PY3+CKAN2.9.
How to reproduce
This error was hit by running the tests on ckanext-dcat_usmetadata, but because of the py3 upgrade surrounding the extension, I'm not sure the tests can run in a reproducible way right now. To illustrate the issue, the following snippet was run,
Expected behavior
We would expect that the extension would give a normal validation error. If the parameter was missing, it would give no error, but if the parameter is of the wrong type, it should probably fail with a 'wrong type' error.
Actual behavior
The code exited with a runtime TypeError.
Sketch
Update the validation functions in ckanext/usmetadata/plugin/helper.py to at least check that the input is a str before running the regex validators.
The text was updated successfully, but these errors were encountered: