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
The current implementation of the /api/v1/forms/<formid>/versions endpoint only supports alphabetic and digit characters in the version_id field. This causes errors when users manually set version IDs that include non-alphanumeric characters, such as dots (.) or other special characters.
Error thrown.
ERROR 2024-10-03 06:21:40,912 log 322 137061597878208 Internal Server Error: /api/v1/forms/1/versions
Traceback (most recent call last):
File "/home/appuser/.pyenv/versions/3.10.14/lib/python3.10/site-packages/rest_framework/relations.py", line 396, in to_representation
url = self.get_url(value, self.view_name, request, format)
File "/srv/onadata/./onadata/libs/serializers/xform_serializer.py", line 168, in get_url
return reverse(view_name, kwargs=kwargs, request=request, format=fmt)
File "/home/appuser/.pyenv/versions/3.10.14/lib/python3.10/site-packages/rest_framework/reverse.py", line 47, in reverse
url = _reverse(viewname, args, kwargs, request, format, **extra)
File "/home/appuser/.pyenv/versions/3.10.14/lib/python3.10/site-packages/rest_framework/reverse.py", line 60, in _reverse
url = django_reverse(viewname, args=args, kwargs=kwargs, **extra)
File "/home/appuser/.pyenv/versions/3.10.14/lib/python3.10/site-packages/django/urls/base.py", line 88, in reverse
return resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
File "/home/appuser/.pyenv/versions/3.10.14/lib/python3.10/site-packages/django/urls/resolvers.py", line 828, in _reverse_with_prefix
raise NoReverseMatch(msg)
django.urls.exceptions.NoReverseMatch: Reverse for 'form-version-detail' with keyword arguments '{'pk': 1, 'version_id': '1.1'}' not found. 2 pattern(s) tried: ['api/v1/forms/(?P<pk>[^/.]+)/versions/(?P<version_id>[^/.]+)\\.(?P<format>[a-z0-9]+)/?$', 'api/v1/forms/(?P<pk>[^/.]+)/versions/(?P<version_id>[^/.]+)$']
Expected behavior
The API should accept version IDs with non-alphanumeric characters such as dots (.) and correctly resolve the version ID in the URL patterns.
Steps to reproduce the behavior
Set a form version ID with a non-alphanumeric character, e.g., 1.1.
Upload the form
Attempt to retrieve form versions using the endpoint /api/v1/forms/<formid>/versions.
The text was updated successfully, but these errors were encountered:
Problem description
The current implementation of the
/api/v1/forms/<formid>/versions
endpoint only supports alphabetic and digit characters in the version_id field. This causes errors when users manually set version IDs that include non-alphanumeric characters, such as dots (.) or other special characters.Error thrown.
Expected behavior
The API should accept version IDs with non-alphanumeric characters such as dots (.) and correctly resolve the version ID in the URL patterns.
Steps to reproduce the behavior
/api/v1/forms/<formid>/versions
.The text was updated successfully, but these errors were encountered: