Use Project.nameKey() in lieu of Project.NameKey.parse() Despite Gerrit allowing the creation of projects with '+' in the name, pushing to LFS appears to fail in this case because the underlying GWTORM methods used by NameKey.parse() replace the '+' with a ' '. Using Project.nameKey() resolves the problem. Also changing the use in LfsLocksAction under the assumption that this is incorrect as well. Change-Id: I6defc59e9dc1a218f6a7e156c2f9fd28565f0ca9
diff --git a/src/main/java/com/googlesource/gerrit/plugins/lfs/LfsApiServlet.java b/src/main/java/com/googlesource/gerrit/plugins/lfs/LfsApiServlet.java index 4db35a9..992dada 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/lfs/LfsApiServlet.java +++ b/src/main/java/com/googlesource/gerrit/plugins/lfs/LfsApiServlet.java
@@ -81,7 +81,7 @@ throw new LfsException("no repository at " + pathInfo); } String projName = matcher.group(1); - Project.NameKey project = Project.NameKey.parse(ProjectUtil.stripGitSuffix(projName)); + Project.NameKey project = Project.nameKey(ProjectUtil.stripGitSuffix(projName)); ProjectState state = projectCache.get(project); if (state == null || state.getProject().getState() == HIDDEN) { throw new LfsRepositoryNotFound(project.get());
diff --git a/src/main/java/com/googlesource/gerrit/plugins/lfs/locks/LfsLocksAction.java b/src/main/java/com/googlesource/gerrit/plugins/lfs/locks/LfsLocksAction.java index 02c77f5..32536f7 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/lfs/locks/LfsLocksAction.java +++ b/src/main/java/com/googlesource/gerrit/plugins/lfs/locks/LfsLocksAction.java
@@ -100,7 +100,7 @@ throws LfsException, IOException; protected ProjectState getProject(String name) throws LfsRepositoryNotFound { - Project.NameKey project = Project.NameKey.parse(ProjectUtil.stripGitSuffix(name)); + Project.NameKey project = Project.nameKey(ProjectUtil.stripGitSuffix(name)); ProjectState state = projectCache.get(project); if (state == null || state.getProject().getState() == HIDDEN) { throw new LfsRepositoryNotFound(project.get());