0
0
mirror of https://github.com/go-gitea/gitea.git synced 2025-11-07 05:09:30 -05:00

Fix cli "Before" handling (#35797)

Regression of #34973

Fix #35796
This commit is contained in:
wxiaoguang
2025-11-01 02:12:03 +08:00
committed by GitHub
parent ef90befef1
commit de70cd3853
5 changed files with 55 additions and 16 deletions

View File

@@ -50,11 +50,15 @@ DEFAULT CONFIGURATION:
func prepareSubcommandWithGlobalFlags(originCmd *cli.Command) {
originBefore := originCmd.Before
originCmd.Before = func(ctx context.Context, cmd *cli.Command) (context.Context, error) {
prepareWorkPathAndCustomConf(cmd)
originCmd.Before = func(ctxOrig context.Context, cmd *cli.Command) (ctx context.Context, err error) {
ctx = ctxOrig
if originBefore != nil {
return originBefore(ctx, cmd)
ctx, err = originBefore(ctx, cmd)
if err != nil {
return ctx, err
}
}
prepareWorkPathAndCustomConf(cmd)
return ctx, nil
}
}