mirror of
https://github.com/google/nomulus.git
synced 2025-05-15 08:57:12 +02:00
Upgrade Nomulus to latest Closure Rules
Significant technical debt has been eliminated. The latest best practices are also now adopted for dealing with runfiles and dealing with files across repositories. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=140762937
This commit is contained in:
parent
79a72387ee
commit
59f4984083
28 changed files with 193 additions and 361 deletions
|
@ -17,7 +17,6 @@ package google.registry.server;
|
|||
import static com.google.common.base.MoreObjects.firstNonNull;
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
import static com.google.common.base.Verify.verify;
|
||||
import static javax.servlet.http.HttpServletResponse.SC_BAD_REQUEST;
|
||||
import static javax.servlet.http.HttpServletResponse.SC_FORBIDDEN;
|
||||
import static javax.servlet.http.HttpServletResponse.SC_NOT_FOUND;
|
||||
|
||||
|
@ -122,12 +121,7 @@ public final class StaticResourceServlet extends HttpServlet {
|
|||
|
||||
Optional<Path> doHead(HttpServletRequest req, HttpServletResponse rsp) throws IOException {
|
||||
verify(req.getRequestURI().startsWith(prefix));
|
||||
Path file = root.resolve(req.getRequestURI().substring(prefix.length())).normalize();
|
||||
if (!file.startsWith(root)) {
|
||||
logger.infofmt("Evil request: %s (%s) (%s + %s)", req.getRequestURI(), file, root, prefix);
|
||||
rsp.sendError(SC_BAD_REQUEST, "Naughty naughty!");
|
||||
return Optional.absent();
|
||||
}
|
||||
Path file = root.resolve(req.getRequestURI().substring(prefix.length()));
|
||||
if (!Files.exists(file)) {
|
||||
logger.infofmt("Not found: %s (%s)", req.getRequestURI(), file);
|
||||
rsp.sendError(SC_NOT_FOUND, "Not found");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue