Rename isValidPath to isAllowedPath
The old method name was misleading. It checked if a path is allowed
to be accessed. It didn't check validity of the file at that path.
Change-Id: I204523d8d90379dca73b2f54135ed578a17b8235
diff --git a/src/main/java/com/googlesource/gerrit/plugins/serverconfig/ServerConfigServlet.java b/src/main/java/com/googlesource/gerrit/plugins/serverconfig/ServerConfigServlet.java
index b93e2eb..01760bd 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/serverconfig/ServerConfigServlet.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/serverconfig/ServerConfigServlet.java
@@ -78,7 +78,7 @@
@Override
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws IOException {
- if (!isValidPath(req)) {
+ if (!isAllowedPath(req)) {
res.setStatus(HttpServletResponse.SC_FORBIDDEN);
return;
}
@@ -88,7 +88,7 @@
@Override
public void doPut(HttpServletRequest req, HttpServletResponse res)
throws IOException {
- if (!isValidPath(req)) {
+ if (!isAllowedPath(req)) {
res.setStatus(HttpServletResponse.SC_FORBIDDEN);
return;
}
@@ -169,7 +169,7 @@
return Files.isSameFile(sitePaths.gerrit_config, resolvePath(req));
}
- private boolean isValidPath(HttpServletRequest req) throws IOException {
+ private boolean isAllowedPath(HttpServletRequest req) throws IOException {
Path p = resolvePath(req);
if (!Files.isRegularFile(p)) {
return false;