Skip to content

Commit 95a5b46

Browse files
author
Alexander Dutton
committed
JsonPointer.from_parts should handle the empty path
[The RFC says](http://tools.ietf.org/html/rfc6901#page-5) that the path `""` points at the original document. However, passing `[]` to `from_parts()` results in a path of `"/"` (the same as when one passes `[""]`. This makes the empty list produce a pointer for the empty path.
1 parent ac7c86e commit 95a5b46

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

jsonpointer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ def from_parts(cls, parts):
283283
parts = [str(part) for part in parts]
284284
parts = [part.replace('~', '~0') for part in parts]
285285
parts = [part.replace('/', '~1') for part in parts]
286-
ptr = cls('/' + '/'.join(parts))
286+
ptr = cls(''.join('/' + part for part in parts))
287287
return ptr
288288

289289

0 commit comments

Comments
 (0)