Skip to content

Commit

Permalink
Checks image name length
Browse files Browse the repository at this point in the history
fixes #2542
  • Loading branch information
Devashishbasu committed Jan 15, 2024
1 parent c387c2b commit f52dfa3
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public class ImageName {
// Digest
private String digest;

private static final int REPO_NAME_MAX_LENGTH = 255;

/**
* Create an image name
*
Expand Down Expand Up @@ -288,6 +290,10 @@ private void doValidate() {
checks[i], value, checkPattern.pattern()));
}
}
if (repository.length() > REPO_NAME_MAX_LENGTH) {
errors.add(String.format("Repository name must not be more than %d characters", REPO_NAME_MAX_LENGTH));
}

if (!errors.isEmpty()) {
StringBuilder buf = new StringBuilder();
buf.append(String.format("Given Docker name '%s' is invalid:%n", getFullName()));
Expand Down

0 comments on commit f52dfa3

Please sign in to comment.