Description
The extractImageTag function in apps/dokploy/pages/api/deploy/[refreshToken].ts has a parsing flaw for Docker images hosted on private registries with port numbers but no explicit tag.
For an image like myregistry:5000/myapp (no tag specified):
const tag = dockerImage.split(":").pop();
return tag === dockerImage ? "latest" : tag;
split(":") on myregistry:5000/myapp produces ["myregistry", "5000/myapp"]. .pop() returns "5000/myapp", which is not equal to the original string, so the function returns "5000/myapp" as the tag instead of "latest".
Meanwhile, extractImageName correctly handles port numbers by checking whether the substring after the last colon is a port via a regex. extractImageTag has no equivalent logic.
Impact
Webhook-triggered auto-deployments for Docker images on private registries (e.g., registry.internal:5000/app) will fail tag matching. The configured tag is parsed as "5000/app" instead of "latest", causing webhook payloads with real tags to be rejected with "Application Image Tag doesn't match".
Fix
Apply the same lastIndexOf + port-number-detection logic from extractImageName to extractImageTag, returning "latest" when the only colon is part of a registry port.
Description
The
extractImageTagfunction inapps/dokploy/pages/api/deploy/[refreshToken].tshas a parsing flaw for Docker images hosted on private registries with port numbers but no explicit tag.For an image like
myregistry:5000/myapp(no tag specified):split(":")onmyregistry:5000/myappproduces["myregistry", "5000/myapp"]..pop()returns"5000/myapp", which is not equal to the original string, so the function returns"5000/myapp"as the tag instead of"latest".Meanwhile,
extractImageNamecorrectly handles port numbers by checking whether the substring after the last colon is a port via a regex.extractImageTaghas no equivalent logic.Impact
Webhook-triggered auto-deployments for Docker images on private registries (e.g.,
registry.internal:5000/app) will fail tag matching. The configured tag is parsed as"5000/app"instead of"latest", causing webhook payloads with real tags to be rejected with"Application Image Tag doesn't match".Fix
Apply the same
lastIndexOf+ port-number-detection logic fromextractImageNametoextractImageTag, returning"latest"when the only colon is part of a registry port.