-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mcr.microsoft.com/mssql/rhel/server:2022-CU13-rhel-9.1 should have one or two '/' #572
Comments
@dosu what do you think? |
To handle image strings like public static Image from(String imageUrl) {
final String[] slashTokens = imageUrl.split("/");
final String repoTag;
final String registry;
final String user;
final String repo;
final String tag;
switch (slashTokens.length) {
case 1:
registry = "";
user = "";
repoTag = slashTokens[0];
break;
case 2:
registry = "";
user = slashTokens[0];
repoTag = slashTokens[1];
break;
case 3:
registry = slashTokens[0];
user = slashTokens[1];
repoTag = slashTokens[2];
break;
default:
// Handle cases with more than two '/' characters
registry = slashTokens[0];
user = String.join("/", Arrays.copyOfRange(slashTokens, 1, slashTokens.length - 1));
repoTag = slashTokens[slashTokens.length - 1];
break;
}
final String[] tokens = repoTag.split(":");
switch (tokens.length) {
case 1:
repo = tokens[0];
tag = "";
break;
case 2:
repo = tokens[0];
tag = tokens[1];
break;
default:
throw new IllegalArgumentException("repoTag '" + repoTag + "' should have zero or one ':' character");
}
return new Image(registry, user, repo, tag);
} This modification ensures that if there are more than two '/' characters, the method correctly assigns the registry and user, and then extracts the |
@dosu any objection with linked pull request? Do you think it address original issue? Are linked tests correctly testing change? |
The linked pull request addresses the original issue by adding a check to ensure that image names do not contain more than two '/' characters. The specific change is: String[] parts = imageUrl.split("/");
if (parts.length > 3) {
throw new IllegalArgumentException("image '" + imageUrl + "' should have one or two '/' characters");
} This code ensures that only valid image URLs are processed by throwing an Regarding the tests, I couldn't find specific information about the unit tests covering the |
The pull request #577 does address the original issue by modifying the parsing logic to handle image URLs with more than two slashes. This change allows the image Regarding the tests, the pull request includes updates to ensure that the new parsing logic is covered. It would be beneficial to review these tests to confirm they adequately cover various scenarios, including edge cases with different numbers of slashes in the image URLs. If the tests are comprehensive and pass successfully, the changes should be good to go. |
XTF does not allow for me to use image like
mcr.microsoft.com/mssql/rhel/server:2022-CU13-rhel-9.1
We need
case 4+:
section here?xtf/core/src/main/java/cz/xtf/core/image/Image.java
Lines 54 to 71 in 1daa976
So we will end up with something like this
The text was updated successfully, but these errors were encountered: