File tree 2 files changed +6
-1
lines changed
2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -344,7 +344,7 @@ def to_internal_value(self, data):
344
344
if data .startswith (prefix ):
345
345
data = '/' + data [len (prefix ):]
346
346
347
- data = uri_to_iri (data )
347
+ data = uri_to_iri (parse . unquote ( data ) )
348
348
349
349
try :
350
350
match = resolve (data )
Original file line number Diff line number Diff line change @@ -153,6 +153,7 @@ def setUp(self):
153
153
self .queryset = MockQueryset ([
154
154
MockObject (pk = 1 , name = 'foobar' ),
155
155
MockObject (pk = 2 , name = 'bazABCqux' ),
156
+ MockObject (pk = 2 , name = 'bazABC qux' ),
156
157
])
157
158
self .field = serializers .HyperlinkedRelatedField (
158
159
view_name = 'example' ,
@@ -191,6 +192,10 @@ def test_hyperlinked_related_lookup_url_encoded_exists(self):
191
192
instance = self .field .to_internal_value ('http://example.org/example/baz%41%42%43qux/' )
192
193
assert instance is self .queryset .items [1 ]
193
194
195
+ def test_hyperlinked_related_lookup_url_space_encoded_exists (self ):
196
+ instance = self .field .to_internal_value ('http://example.org/example/bazABC%20qux/' )
197
+ assert instance is self .queryset .items [2 ]
198
+
194
199
def test_hyperlinked_related_lookup_does_not_exist (self ):
195
200
with pytest .raises (serializers .ValidationError ) as excinfo :
196
201
self .field .to_internal_value ('http://example.org/example/doesnotexist/' )
You can’t perform that action at this time.
0 commit comments