opencontainers/distribution-spec

Image "Name" Regex Nit

juliusl opened this issue · 2 comments

Currently the repo name regex in the spec is,

[a-z0-9]+((\.|_|__|-+)[a-z0-9]+)*(/[a-z0-9]+((\.|_|__|-+)[a-z0-9]+)*)*

Some regex parsers want / to be escaped, however others do not recognize an escaped /. I propose using [/] to avoid ambiguity.

[a-z0-9]+((\.|_|__|-+)[a-z0-9]+)*([/][a-z0-9]+((\.|_|__|-+)[a-z0-9]+)*)*
                                  ^^^ ---- change is here

Another minor thing I noticed that I'm piggybacking on this issue. Why are capital letters unallowed for the repo name, but allowed for the tag?

Edit

Example of a parser that will warn about escaping,

https://regexr.com/7lrpf

Which parsers fail with an escaped /? I'm incline to escape it and let the few implementations that need it unescaped adjust the value for their implementation.

@sudo-bmitch it's a bit hard to show but the regex derive attribute from this crate https://crates.io/crates/logos will complain about escaping.

I'm incline to escape it and let the few implementations that need it unescaped adjust the value for their implementation.

Seems reasonable as well.