Protect against empty OS string in Docker Image
Update `Image` to protect against `os` being `null` or and empty String. Fixes gh-45152
This commit is contained in:
@@ -26,6 +26,7 @@ import java.util.List;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
|
||||
import org.springframework.boot.buildpack.platform.json.MappedObject;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Image details as returned from {@code Docker inspect}.
|
||||
@@ -90,7 +91,7 @@ public class Image extends MappedObject {
|
||||
* @return the image OS
|
||||
*/
|
||||
public String getOs() {
|
||||
return (this.os != null) ? this.os : "linux";
|
||||
return (!StringUtils.hasText(this.os)) ? this.os : "linux";
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user