fix: prevent incorrect Docker Hub links for private registries#200
fix: prevent incorrect Docker Hub links for private registries#200saishparadkar10 wants to merge 2 commits into
Conversation
|
@microsoft-github-policy-service agree |
|
This looks similar to #198; can you check if it's the Docker DX extension that's contributing these links? |
|
Yes, you are correct. When the Docker extension is present, it overrides Compose's image links due to I have updated this PR to include the fix from #198 (setting This ensures private/custom registry names (including single-word hostnames like |
|
Going to merge #191 instead, but including the change this PR has to keep image linking even when Docker DX is present. |
Summary
This PR fixes a bug where hovering over an
image:field containing a private/custom registry reference incorrectly generates a DocumentLink pointing to Docker Hub.This PR addresses the issue in two ways:
imageLinks: falseinAlternateYamlLanguageServiceClientFeature.ts(similar to Keep Compose image links local when Docker is present #198) so that the Compose language service maintains control over image links even when the Docker extension is present, rather than delegating it to Docker's buggy provider.getLinkForImageinImageLinkProvider.tsto verify whether the first segment of the image path is a registry hostname (by checking for.,:, or if it is equal tolocalhost). If a custom/private registry is detected, no link is generated (except for the specialmcr.microsoft.comcase). This prevents the Compose provider itself from incorrectly linking local or custom registries (e.g.localhost/alpineor custom hostnames) to Docker Hub.Fixes #179.
Root cause
localhost), leading it to match private registry names as Docker Hub namespaces.Solution
imageLinks: falseinAlternateYamlLanguageServiceClientFeature.tsto disable delegation when Docker is present.getLinkForImageinImageLinkProvider.tsto detect registry hostnames in image paths.ImageLinkProvider.test.tsto coverlocalhost/alpineand private registry images (e.g.,nrt.vultrcr.com/wulicoco/code-sync).Testing performed
npm test).Limitations
None.