fix(sec): modify api route for variables
This commit is contained in:
parent
3705555f67
commit
caeb95cb10
|
@ -475,7 +475,7 @@ func (Action) UpdateVariable(ctx *context.APIContext) {
|
||||||
if opt.Name == "" {
|
if opt.Name == "" {
|
||||||
opt.Name = ctx.Params("variablename")
|
opt.Name = ctx.Params("variablename")
|
||||||
}
|
}
|
||||||
if _, err := actions_service.UpdateVariable(ctx, v.ID, opt.Name, opt.Value); err != nil {
|
if _, err := actions_service.UpdateVariable(ctx, v.ID, ctx.Org.Organization.ID, 0, opt.Name, opt.Value); err != nil {
|
||||||
if errors.Is(err, util.ErrInvalidArgument) {
|
if errors.Is(err, util.ErrInvalidArgument) {
|
||||||
ctx.Error(http.StatusBadRequest, "UpdateVariable", err)
|
ctx.Error(http.StatusBadRequest, "UpdateVariable", err)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -414,7 +414,7 @@ func (Action) UpdateVariable(ctx *context.APIContext) {
|
||||||
if opt.Name == "" {
|
if opt.Name == "" {
|
||||||
opt.Name = ctx.Params("variablename")
|
opt.Name = ctx.Params("variablename")
|
||||||
}
|
}
|
||||||
if _, err := actions_service.UpdateVariable(ctx, v.ID, opt.Name, opt.Value); err != nil {
|
if _, err := actions_service.UpdateVariable(ctx, v.ID, 0, ctx.Repo.Repository.ID, opt.Name, opt.Value); err != nil {
|
||||||
if errors.Is(err, util.ErrInvalidArgument) {
|
if errors.Is(err, util.ErrInvalidArgument) {
|
||||||
ctx.Error(http.StatusBadRequest, "UpdateVariable", err)
|
ctx.Error(http.StatusBadRequest, "UpdateVariable", err)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -228,7 +228,7 @@ func UpdateVariable(ctx *context.APIContext) {
|
||||||
if opt.Name == "" {
|
if opt.Name == "" {
|
||||||
opt.Name = ctx.Params("variablename")
|
opt.Name = ctx.Params("variablename")
|
||||||
}
|
}
|
||||||
if _, err := actions_service.UpdateVariable(ctx, v.ID, opt.Name, opt.Value); err != nil {
|
if _, err := actions_service.UpdateVariable(ctx, v.ID, ctx.Doer.ID, 0, opt.Name, opt.Value); err != nil {
|
||||||
if errors.Is(err, util.ErrInvalidArgument) {
|
if errors.Is(err, util.ErrInvalidArgument) {
|
||||||
ctx.Error(http.StatusBadRequest, "UpdateVariable", err)
|
ctx.Error(http.StatusBadRequest, "UpdateVariable", err)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue