Skip to content

Commit

Permalink
Return 404 if files have not been served
Browse files Browse the repository at this point in the history
  • Loading branch information
rafahop committed Jun 20, 2022
1 parent 4a1d499 commit 9c538e5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.onsdigital</groupId>
<artifactId>restolino</artifactId>
<version>0.2.2-SNAPSHOT</version>
<version>undefined</version>
<packaging>jar</packaging>
<name>Restolino</name>
<description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,15 @@ public void reload() throws IOException {
@Override
public void handle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {

// Should we try redirecting to index.html?
boolean isApiRequest = isApiRequest(target);
try {
if (preFilter(request, response)) {
if (isApiRequest) {
if (isApiRequest(target)) {
apiHandler.handle(target, baseRequest, request, response);
} else if (filesHandler != null) {
filesHandler.handle(target, baseRequest, request, response);
if (!baseRequest.isHandled()) {
notFound(target, response);
}
} else {
notFound(target, response);
}
Expand Down

0 comments on commit 9c538e5

Please sign in to comment.