in src/main/java/com/googlesource/gerrit/plugins/uploadvalidator/InvalidFilenameValidator.java [91:121]
public List<CommitValidationMessage> onCommitReceived(CommitReceivedEvent receiveEvent)
throws CommitValidationException {
try {
PluginConfig cfg =
cfgFactory.getFromProjectConfigWithInheritance(
receiveEvent.project.getNameKey(), pluginName);
if (isActive(cfg)
&& validatorConfig.isEnabled(
receiveEvent.user,
receiveEvent.getProjectNameKey(),
receiveEvent.getRefName(),
KEY_INVALID_FILENAME,
receiveEvent.pushOptions)) {
try (Repository repo = repoManager.openRepository(receiveEvent.project.getNameKey())) {
List<CommitValidationMessage> messages =
performValidation(
repo,
receiveEvent.commit,
receiveEvent.revWalk,
cfg.getStringList(KEY_INVALID_FILENAME_PATTERN));
if (!messages.isEmpty()) {
throw new CommitValidationException(
"contains files with an invalid filename", messages);
}
}
}
} catch (NoSuchProjectException | IOException e) {
throw new CommitValidationException("failed to check on invalid file names", e);
}
return Collections.emptyList();
}