Improve ImageName/ImageReference parse performance
Update `ImageName` and `ImageReference` to use distinct regex patterns to parse specific parts of the value. Prior to this commit a single regex pattern was used which could hang given certain input strings. Fixes gh-23115
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2020 the original author or authors.
|
||||
* Copyright 2012-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -171,6 +171,14 @@ class ImageReferenceTests {
|
||||
"docker.io/library/ubuntu:bionic@sha256:6e9f67fa63b0323e9a1e587fd71c561ba48a034504fb804fd26fd8800039835d");
|
||||
}
|
||||
|
||||
@Test
|
||||
void ofWhenHasIllegalCharacter() {
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> ImageReference
|
||||
.of("registry.example.com/example/example-app:1.6.0-dev.2.uncommitted+wip.foo.c75795d"))
|
||||
.withMessageContaining("Unable to parse image reference");
|
||||
}
|
||||
|
||||
@Test
|
||||
void forJarFile() {
|
||||
assertForJarFile("spring-boot.2.0.0.BUILD-SNAPSHOT.jar", "library/spring-boot", "2.0.0.BUILD-SNAPSHOT");
|
||||
|
||||
Reference in New Issue
Block a user