mirror of
https://github.com/DerDavidBohl/dirigent-spring.git
synced 2025-12-30 08:49:50 -06:00
feat: update: Made url building more robust
This commit is contained in:
@@ -31,6 +31,10 @@ public class ContainerRegistryClient {
|
||||
private final ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
public String getRegistryDigest(String registryEndpoint, String name, String tag) throws CouldNotGetManifestDigestFromRegistryFailedException {
|
||||
|
||||
if(!registryEndpoint.startsWith("https://") && !registryEndpoint.startsWith("http://"))
|
||||
registryEndpoint = "https://" + registryEndpoint;
|
||||
|
||||
String token = getToken(registryEndpoint, name);
|
||||
try {
|
||||
return getManifestDigest(registryEndpoint, name, tag, token);
|
||||
@@ -79,7 +83,7 @@ public class ContainerRegistryClient {
|
||||
|
||||
HttpEntity<Void> req = new HttpEntity<>(h);
|
||||
|
||||
String uri =registryEndpoint + name + "/manifests/" + tag;
|
||||
String uri =registryEndpoint + "/v2/" + name + "/manifests/" + tag;
|
||||
|
||||
String body = rest.exchange(
|
||||
uri,
|
||||
|
||||
@@ -28,7 +28,7 @@ private ContainerRegistryClient client;
|
||||
|
||||
@Test
|
||||
void checkDockerImage() throws CouldNotGetManifestDigestFromRegistryFailedException {
|
||||
client.getRegistryDigest("registry-1.docker.io", "mcp/slack", "latest");
|
||||
client.getRegistryDigest("https://registry-1.docker.io", "mcp/slack", "latest");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user