commit e3ca2ce444a669395f05f863bf31bf06d8e8d9f7
parent 8cbf0373bdcba760a3e7acbd67ef92b9c758f70e
Author: Jacob R. Edwards <jacob@jacobedwards.org>
Date: Thu, 29 Aug 2024 11:40:29 -0700
Fix remove and move operations
I had just set the values I wanted to delete to nil instead of
actually deleting them.
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/cmd/api/patch.go b/cmd/api/patch.go
@@ -26,7 +26,7 @@ func applyPatch(data map[string]interface{}, p backend.Patch) error {
if !exists {
return errors.New("Cannot remove non-existent")
}
- data[p.Path] = nil
+ delete(data, p.Path)
case "add":
data[p.Path] = p.Value
case "replace":
@@ -40,7 +40,7 @@ func applyPatch(data map[string]interface{}, p backend.Patch) error {
return errors.New("From does not exist")
}
data[p.Path] = data[p.From]
- data[p.From] = nil
+ delete(data, p.From)
case "copy":
fv, fexists := data[p.From]
if !fexists {