Set Created
to 0001-01-01T00:00:00Z
on older API versions
This matches the prior behavior before2a6ff3c24f
. This also updates the Swagger documentation for the current version to note that the field might be the empty string and what that means. Signed-off-by: Tianon Gravi <admwiggin@gmail.com> (cherry picked from commitb4fbe226e8
) Signed-off-by: Bjorn Neergaard <bjorn.neergaard@docker.com>
This commit is contained in:
parent
f417435e5f
commit
fa3a64f2bc
3 changed files with 8 additions and 2 deletions
|
@ -298,6 +298,12 @@ func (ir *imageRouter) getImagesByName(ctx context.Context, w http.ResponseWrite
|
|||
version := httputils.VersionFromContext(ctx)
|
||||
if versions.LessThan(version, "1.44") {
|
||||
imageInspect.VirtualSize = imageInspect.Size //nolint:staticcheck // ignore SA1019: field is deprecated, but still set on API < v1.44.
|
||||
|
||||
if imageInspect.Created == "" {
|
||||
// backwards compatibility for Created not existing returning "0001-01-01T00:00:00Z"
|
||||
// https://github.com/moby/moby/issues/47368
|
||||
imageInspect.Created = time.Time{}.Format(time.RFC3339Nano)
|
||||
}
|
||||
}
|
||||
return httputils.WriteJSON(w, http.StatusOK, imageInspect)
|
||||
}
|
||||
|
|
|
@ -1742,7 +1742,7 @@ definitions:
|
|||
Created:
|
||||
description: |
|
||||
Date and time at which the image was created, formatted in
|
||||
[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.
|
||||
[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds, or empty if the field was not set in the image config.
|
||||
type: "string"
|
||||
x-nullable: false
|
||||
example: "2022-02-04T21:20:12.497794809Z"
|
||||
|
|
|
@ -1742,7 +1742,7 @@ definitions:
|
|||
Created:
|
||||
description: |
|
||||
Date and time at which the image was created, formatted in
|
||||
[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds.
|
||||
[RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format with nano-seconds, or empty if the field was not set in the image config.
|
||||
type: "string"
|
||||
x-nullable: false
|
||||
example: "2022-02-04T21:20:12.497794809Z"
|
||||
|
|
Loading…
Reference in a new issue