Skip to content

[Bug]: ExtractRegistryAndRepo mishandles digest-pinned refs and registries with ports #74

Description

Version

sbi version: main @ d9404ec
OS: N/A (pure string-parsing bug)
Go: 1.26.5

What happened?

ExtractRegistryAndRepo splits on the first :, which breaks digest-pinned references and host:port registries:

Input Actual Expected
mcr.microsoft.com/dotnet/aspnet:8.0@sha256:abc tag=8.0@sha256:abc tag=8.0
mcr.microsoft.com/dotnet/aspnet@sha256:abc repo ends with @sha256, tag=abc clean repo, empty tag
localhost:5000/myrepo:1.0 reg=mcr.microsoft.com, tag=5000/myrepo:1.0 reg=localhost:5000, tag=1.0

This corrupts registry / repository / tag columns and can interact badly with UNIQUE(registry, repository, tag).

Expected: Parse like Docker references — strip @digest first; last : after last / is the tag; allow host:port registries.

Steps to reproduce

  1. Call ExtractRegistryAndRepo with the inputs in the table above (unit test).
  2. Observe incorrect registry / repository / tag fields.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions