Repository navigation
Reject moving any location into its own children, fixes #214 - #222
Merged
Merged
Conversation
RFC 6902, 4.4 forbids "from" being a proper prefix of "path". This was
only enforced when the moved value was an object member: an array
element was removed first and the target then resolved against the
shifted array, so [[], []] with a move from /0 to /0/0 silently moved
the first element into the second. Moving the whole document ("from"
is "") crashed with a TypeError for arrays, because the value was
looked up with a None index before any check.
The prefix check now runs before anything is resolved, for all
container types. Moving a location onto itself stays a no-op,
including "" onto "".
This reverts the behaviour added in 7e459af, which allowed moving an
array item into a sibling; test_move_array_item_into_other_item now
expects a conflict.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QHyxsJBfMEj5XC5R122Xzn
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
RFC 6902, 4.4 forbids "from" being a proper prefix of "path". This was
only enforced when the moved value was an object member: an array
element was removed first and the target then resolved against the
shifted array, so [[], []] with a move from /0 to /0/0 silently moved
the first element into the second. Moving the whole document ("from"
is "") crashed with a TypeError for arrays, because the value was
looked up with a None index before any check.
The prefix check now runs before anything is resolved, for all
container types. Moving a location onto itself stays a no-op,
including "" onto "".
This reverts the behaviour added in 7e459af, which allowed moving an
array item into a sibling; test_move_array_item_into_other_item now
expects a conflict.
Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01QHyxsJBfMEj5XC5R122Xzn