feat: update: Made url building more robust

This commit is contained in:
DerDavidBohl
2025-11-28 18:33:45 +01:00
parent b7dbfc5db8
commit cea4f8eefd
2 changed files with 6 additions and 2 deletions

View File

@@ -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,

View File

@@ -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