1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #43552 from thaJeztah/remove_redundant_validation

api:  postContainersStop, postContainersRestart  remove redundant validation
This commit is contained in:
Sebastiaan van Stijn 2022-05-06 17:47:33 +02:00 committed by GitHub
commit 7b08faa089
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -225,12 +225,7 @@ func (s *containerRouter) postContainersStop(ctx context.Context, w http.Respons
version = httputils.VersionFromContext(ctx)
)
if versions.GreaterThanOrEqualTo(version, "1.42") {
if sig := r.Form.Get("signal"); sig != "" {
if _, err := signal.ParseSignal(sig); err != nil {
return errdefs.InvalidParameter(err)
}
options.Signal = sig
}
options.Signal = r.Form.Get("signal")
}
if tmpSeconds := r.Form.Get("t"); tmpSeconds != "" {
valSeconds, err := strconv.Atoi(tmpSeconds)
@ -283,12 +278,7 @@ func (s *containerRouter) postContainersRestart(ctx context.Context, w http.Resp
version = httputils.VersionFromContext(ctx)
)
if versions.GreaterThanOrEqualTo(version, "1.42") {
if sig := r.Form.Get("signal"); sig != "" {
if _, err := signal.ParseSignal(sig); err != nil {
return errdefs.InvalidParameter(err)
}
options.Signal = sig
}
options.Signal = r.Form.Get("signal")
}
if tmpSeconds := r.Form.Get("t"); tmpSeconds != "" {
valSeconds, err := strconv.Atoi(tmpSeconds)