api: fix missing return after error in SystemCheck handler

In the SystemCheck HTTP handler, when parsing the
unreferenced_layer_max_age query parameter fails, the error response is
sent but execution continues to `unreferencedLayerMaximumAge = &duration`
where `duration` is the zero value. This causes the system check to run
with a zero duration instead of returning the 400 error to the client.

Add the missing `return` after the error response.

Fixes #28350

Signed-off-by: crawfordxx <crawfordxx@users.noreply.github.com>
(cherry picked from commit 29d80a26af)
Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
crawfordxx 2026-03-24 12:12:19 +08:00 • committed by Paul Holzinger
parent c91cd99291
commit e5fe3fdf69
No known key found for this signature in database
GPG key ID: EB145DD938A3CAF2

View file

@ -96,6 +96,7 @@ func SystemCheck(w http.ResponseWriter, r *http.Request) {
if err != nil {
utils.Error(w, http.StatusBadRequest,
fmt.Errorf("failed to parse unreferenced_layer_max_age parameter %q for %s: %w", query.UnreferencedLayerMaximumAge, r.URL.String(), err))
return
}
unreferencedLayerMaximumAge = &duration
}