Bug caused by storing webid in username
I logged in to an instance using my account from another OIDC provider. This created a local user for me, with my webid as the username:
It then uses the URL username as the slug for the user
Whenever I serialize this user, an error is raised by Django rest framework's serializer code:
Internal Server Error: /users/
Traceback (most recent call last):
...
File "/Users/calummackervoy/Documents/Git/sib-app-3.6/env_python3_6/lib/python3.6/site-packages/rest_framework/mixins.py", line 46, in list
return Response(serializer.data)
...
File "/Users/calummackervoy/Documents/Git/sib-app-3.6/startinblox/djangoldp/serializers.py", line 278, in to_representation
data = super().to_representation(obj)
File "/Users/calummackervoy/Documents/Git/sib-app-3.6/env_python3_6/lib/python3.6/site-packages/rest_framework/serializers.py", line 513, in to_representation
attribute = field.get_attribute(instance)
File "/Users/calummackervoy/Documents/Git/sib-app-3.6/startinblox/djangoldp/serializers.py", line 96, in get_attribute
parent_id = parent_id_field.get_url(instance, parent_id_field.view_name, context['request'], context['format'])
File "/Users/calummackervoy/Documents/Git/sib-app-3.6/env_python3_6/lib/python3.6/site-packages/rest_framework/relations.py", line 331, in get_url
return self.reverse(view_name, kwargs=kwargs, request=request, format=format)
...
File "/Users/calummackervoy/Documents/Git/sib-app-3.6/env_python3_6/lib/python3.6/site-packages/django/urls/resolvers.py", line 497, in _reverse_with_prefix
raise NoReverseMatch(msg)
django.urls.exceptions.NoReverseMatch: Reverse for 'ldpuser-detail' with keyword arguments '{'slug': 'https://api.test-paris.happy-dev.fr/users/calum/'}' not found. 1 pattern(s) tried: ['users/(?P<slug>[\\w\\-\\.]+)/$']
This breaks any use of the user, including containers i.e. /users/
. It's blocking federation
@sylvain @balessan @jbpasquier I suppose the "simple" solution is to store the WebID in a different field (and generate a uuid for remote users instead), but this will potentially affect an unknown number of places in the code?