forked from TrueCloudLab/distribution
reference: remove support for deprecated "shortid" refs
The "shortid" syntax was added ind26a3b37a6
, and allowed for matching an image on its ID prefix (this is before images were content-addressable). With the introduction of content-addressable references, this syntax became problematic, and Docker deprecated this syntax in 2016 (Docker v1.13.0) through commit;5fc71599a0
> The `repository:shortid` syntax for referencing images is very little used, > collides with tag references, and can be confused with digest references. Support for this syntax was removed in 2017 (Docker 17.12) through commit:a942c92dd7
containerd uses a fork of the reference package with this syntax removed, and does not support this syntax:901bcb2231
This patch removes the deprecated syntax, the ParseAnyReferenceWithSet function, and the ShortIdentifierRegexp regex. As there are no external consumers for this function, nor the regexp, I'm skipping a deprecation cycle for this; - https://grep.app/search?q=.ShortIdentifierRegexp - https://grep.app/search?q=.ParseAnyReferenceWithSet%28 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
e3509fc1de
commit
6d4f62d7fd
4 changed files with 1 additions and 115 deletions
|
@ -4,7 +4,6 @@ import (
|
|||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/distribution/distribution/v3/digestset"
|
||||
"github.com/opencontainers/go-digest"
|
||||
)
|
||||
|
||||
|
@ -179,20 +178,3 @@ func ParseAnyReference(ref string) (Reference, error) {
|
|||
|
||||
return ParseNormalizedNamed(ref)
|
||||
}
|
||||
|
||||
// ParseAnyReferenceWithSet parses a reference string as a possible short
|
||||
// identifier to be matched in a digest set, a full digest, or familiar name.
|
||||
func ParseAnyReferenceWithSet(ref string, ds *digestset.Set) (Reference, error) {
|
||||
if ok := anchoredShortIdentifierRegexp.MatchString(ref); ok {
|
||||
dgst, err := ds.Lookup(ref)
|
||||
if err == nil {
|
||||
return digestReference(dgst), nil
|
||||
}
|
||||
} else {
|
||||
if dgst, err := digest.Parse(ref); err == nil {
|
||||
return digestReference(dgst), nil
|
||||
}
|
||||
}
|
||||
|
||||
return ParseNormalizedNamed(ref)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue