소스 검색

api: Only return a Platform when relevant information is available

I noticed that we could return a Platform that has no information filled
in. This doesn't look like it would cause any problems, but it would be
confusing. Fix the handler to only append to this slice when the
Platform is not empty.

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
Aaron Lehmann 8 년 전
부모
커밋
df86a14af2
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      api/server/router/distribution/distribution_routes.go

+ 1 - 1
api/server/router/distribution/distribution_routes.go

@@ -122,7 +122,7 @@ func (s *distributionRouter) getDistributionInfo(ctx context.Context, w http.Res
 		var platform v1.Platform
 		var platform v1.Platform
 		if err == nil {
 		if err == nil {
 			err := json.Unmarshal(configJSON, &platform)
 			err := json.Unmarshal(configJSON, &platform)
-			if err == nil {
+			if err == nil && (platform.OS != "" || platform.Architecture != "") {
 				distributionInspect.Platforms = append(distributionInspect.Platforms, platform)
 				distributionInspect.Platforms = append(distributionInspect.Platforms, platform)
 			}
 			}
 		}
 		}