Skip to content

Commit 616e325

Browse files
committed
#782: Fixes relative json pointer format validation for leading zero on digit
1 parent 069a09b commit 616e325

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

jsonschema/_format.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,10 @@ def is_relative_json_pointer(instance):
432432
non_negative_integer, rest = [], ""
433433
for i, character in enumerate(instance):
434434
if character.isdigit():
435+
# digits with a leading "0" are not allowed
436+
if i > 0 and int(instance[i-1]) == 0:
437+
return False
438+
435439
non_negative_integer.append(character)
436440
continue
437441

0 commit comments

Comments
 (0)