opencontainers / distribution-spec

OCI Distribution Specification
https://opencontainers.org
Apache License 2.0
781 stars 201 forks source link

Image "Name" Regex Nit #484

Closed juliusl closed 7 months ago

juliusl commented 8 months ago

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

sudo-bmitch commented 8 months ago

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.

juliusl commented 8 months ago

@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.