fix: Correct .data path layering edge case

This patch set corrects logic for an edge case in layering where
the action `path` is set to `.data`. In this case this means
that the root of the data section should be used, i.e. '.'
or '$.'. The previous adjustment was incorrect: .data was being
changed to empty string ''. This fixes that logic to change to
'.'.

Change-Id: Id6cf0d4d65020220c540eb162a33055035336cde
This commit is contained in:
Felipe Monteiro 2018-10-07 15:02:08 -04:00
parent f9e4b5993f
commit 2ea808cae2
1 changed files with 5 additions and 0 deletions

View File

@ -547,8 +547,13 @@ class DocumentLayering(object):
child_data = {}
action_path = action['path']
if action_path.startswith('.data'):
action_path = action_path[5:]
elif action_path.startswith('$.data'):
action_path = action_path[6:]
if not (action_path.startswith('.') or action_path.startswith('$.')):
action_path = '.' + action_path
if method == self._DELETE_ACTION:
if action_path == '.':