MCPcopy Create free account
hub / github.com/apache/mesos / validateImageID

Function validateImageID

src/appc/spec.cpp:102–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100
101
102Option<Error> validateImageID(const string& imageId)
103{
104 if (!strings::startsWith(imageId, "sha512-")) {
105 return Error("Image ID needs to start with sha512-");
106 }
107
108 string hash = strings::remove(imageId, "sha512-", strings::PREFIX);
109 if (hash.length() != 128) {
110 return Error("Invalid hash length for: " + hash);
111 }
112
113 return None();
114}
115
116
117Option<Error> validateLayout(const string& imagePath)

Callers 1

validateFunction · 0.85

Calls 4

startsWithFunction · 0.85
NoneClass · 0.85
ErrorFunction · 0.50
removeFunction · 0.50

Tested by

no test coverage detected