From 34064e75ca21933d70bb6fff3ec07aa49d4c1808 Mon Sep 17 00:00:00 2001 From: Fabian Burth Date: Fri, 13 Dec 2024 08:56:04 +0100 Subject: [PATCH] fix: ocm transfer ignored --enforce when --overwrite is set (#1187) #### What this PR does / why we need it Fixes a bug in the `ocm transfer` command, that caused the `--enforce` option to be ignored if `--overwrite` was set. #### Which issue(s) this PR fixes #1186 --- .../ocmcmds/common/options/overwriteoption/option.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmds/ocm/commands/ocmcmds/common/options/overwriteoption/option.go b/cmds/ocm/commands/ocmcmds/common/options/overwriteoption/option.go index 6cc4c32988..2073280614 100644 --- a/cmds/ocm/commands/ocmcmds/common/options/overwriteoption/option.go +++ b/cmds/ocm/commands/ocmcmds/common/options/overwriteoption/option.go @@ -50,10 +50,14 @@ versions are re-transported). func (o *Option) ApplyTransferOption(opts transferhandler.TransferOptions) error { if (o.overwrite != nil && o.overwrite.Changed) || o.Overwrite { - return standard.Overwrite(o.Overwrite).ApplyTransferOption(opts) + if err := standard.Overwrite(o.Overwrite).ApplyTransferOption(opts); err != nil { + return err + } } if (o.enforce != nil && o.enforce.Changed) || o.EnforceTransport { - return standard.EnforceTransport(o.EnforceTransport).ApplyTransferOption(opts) + if err := standard.EnforceTransport(o.EnforceTransport).ApplyTransferOption(opts); err != nil { + return err + } } return nil }