From 5952169c169493c483f54d7345ab870a6bd5011d Mon Sep 17 00:00:00 2001 From: Julio Chana Date: Fri, 27 Sep 2024 11:35:01 +0200 Subject: [PATCH] fix: Add code so there's no error given if an empty file is given as a patch --- plugin/builtin/patchtransformer/PatchTransformer.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugin/builtin/patchtransformer/PatchTransformer.go b/plugin/builtin/patchtransformer/PatchTransformer.go index 04f15b7ee0..062e57930a 100644 --- a/plugin/builtin/patchtransformer/PatchTransformer.go +++ b/plugin/builtin/patchtransformer/PatchTransformer.go @@ -59,8 +59,9 @@ func (p *plugin) Config(h *resmap.PluginHelpers, c []byte) error { patchesSM, errSM := h.ResmapFactory().RF().SliceFromBytes([]byte(p.patchText)) patchesJson, errJson := jsonPatchFromBytes([]byte(p.patchText)) - if (errSM == nil && errJson == nil) || - (patchesSM != nil && patchesJson != nil) { + if ((errSM == nil && errJson == nil) || + (patchesSM != nil && patchesJson != nil)) && + (len(patchesSM) > 0 && len(patchesJson) > 0) { return fmt.Errorf( "illegally qualifies as both an SM and JSON patch: %s", p.patchSource)