Skip to content

Commit

Permalink
check NoSuchFileException for handler
Browse files Browse the repository at this point in the history
  • Loading branch information
jixinchi committed Oct 11, 2023
1 parent 916af55 commit 182cb7e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main/java/org/gaul/s3proxy/S3ProxyHandlerJetty.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package org.gaul.s3proxy;

import java.nio.file.NoSuchFileException;
import java.io.IOException;
import java.io.InputStream;
import java.util.concurrent.TimeoutException;
Expand Down Expand Up @@ -153,6 +154,13 @@ public void handle(String target, Request baseRequest,
code.getMessage(), ImmutableMap.<String, String>of());
baseRequest.setHandled(true);
return;
} else if (Throwables2.getFirstThrowableOfType(throwable,
NoSuchFileException.class) != null) {
// jcloud.blobstore does not check file exists in getContainerAccess when using filesystem
S3ErrorCode code = S3ErrorCode.NO_SUCH_BUCKET;
handler.sendSimpleErrorResponse(request, response, code,
code.getMessage(), ImmutableMap.<String, String>of());
baseRequest.setHandled(true);
} else {
logger.debug("Unknown exception:", throwable);
throw throwable;
Expand Down

0 comments on commit 182cb7e

Please sign in to comment.