-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
HyperlinkedRelatedField exception on string with %20 instead of space #4748
Comments
Looks legit as https://github.com/tomchristie/django-rest-framework/blob/master/rest_framework/generics.py#L96 doesn't unquote the data from url. |
I'm rather surprised - I'd have fully expected that percent encoding is handled for you by Django's URL routing. A failing test case here might be a good first pass. |
@xordoquy what you linked seems unrelated, as the error mentioned here is most likely raised from:
The view with custom lookup field doesn't seem to cause any trouble by itself.
So why does In related field we deal with user provided |
@tomchristie @rooterkyberian @xordoquy it seems to be broken again since the Django's See what they've changed: django/django@03281d8#diff-d3fe562051dcbab80f60f067fa6a5838R180 I.e. now, And the unit test in DRF passes because here #5179 it doesn't cover the %20 case. Thus, HyperlinkedRelatedField appear to be not fully compatible with Django 2.0+ |
Thanks @hexvolt. |
@rpkilby if you don't mind, can you include this on 3.11.x milestone? the milestone tag seems wrong |
Use serializers.HyperlinkedRelatedField where defined lookup_field link to the field string causes an exception 'Invalid hyperlink - Object does not exist.' when the value of that field contains characters that are encoded in the url. eg space -> %20
Missing unquote when try get the value from the url
The text was updated successfully, but these errors were encountered: