@@ -5,10 +5,7 @@ use regex::Regex;
55
66// Matches tags that are numeric-only (e.g. "1.2.3" or "1_2-3")
77static VERSION_RE : LazyLock < Regex > =
8- LazyLock :: new ( || Regex :: new ( r"^(?:\d+(?:[._-]\d+)*)$" ) . unwrap ( ) ) ;
9- // Capture a numeric version inside a tag (e.g. "v1.2" -> captures "1.2")
10- static VER_CAPTURE_RE : LazyLock < Regex > =
11- LazyLock :: new ( || Regex :: new ( r"(?P<ver>\d+(?:[._-]\d+)*)" ) . unwrap ( ) ) ;
8+ LazyLock :: new ( || Regex :: new ( r"^(?P<ver>\d+(?:[._-]\d+)*)$" ) . unwrap ( ) ) ;
129
1310// Compare two numeric-version vectors treating missing components as zeros.
1411fn compare_version_vec ( a : & [ u64 ] , b : & [ u64 ] ) -> std:: cmp:: Ordering {
@@ -176,17 +173,15 @@ pub fn derive_image_prefill(
176173 if tag_l == "edge" {
177174 continue ;
178175 }
179- // require the whole tag to be numeric-like, then capture the numeric portion
180- if VERSION_RE . is_match ( & tag_l) {
181- if let Some ( cap) = VER_CAPTURE_RE . captures ( & tag_l) {
182- let ver = & cap[ "ver" ] ;
183- let nums: Vec < u64 > = ver
184- . split ( |c| c == '.' || c == '_' || c == '-' )
185- . filter_map ( |p| p. parse :: < u64 > ( ) . ok ( ) )
186- . collect ( ) ;
187- if !nums. is_empty ( ) {
188- semvers. push ( ( ( * img) , nums) ) ;
189- }
176+ // require the whole tag to be numeric-like
177+ if let Some ( cap) = VERSION_RE . captures ( & tag_l) {
178+ let ver = & cap[ "ver" ] ;
179+ let nums: Vec < u64 > = ver
180+ . split ( |c| c == '.' || c == '_' || c == '-' )
181+ . filter_map ( |p| p. parse :: < u64 > ( ) . ok ( ) )
182+ . collect ( ) ;
183+ if !nums. is_empty ( ) {
184+ semvers. push ( ( ( * img) , nums) ) ;
190185 }
191186 }
192187 }
0 commit comments