|
18 | 18 | */ |
19 | 19 | package org.elasticsearch.repositories.s3; |
20 | 20 |
|
21 | | -import org.elasticsearch.test.fixture.AbstractHttpFixture; |
22 | 21 | import com.amazonaws.util.DateUtils; |
| 22 | + |
23 | 23 | import org.elasticsearch.common.Strings; |
24 | 24 | import org.elasticsearch.common.io.Streams; |
25 | 25 | import org.elasticsearch.common.path.PathTrie; |
26 | 26 | import org.elasticsearch.common.util.concurrent.ConcurrentCollections; |
27 | 27 | import org.elasticsearch.rest.RestStatus; |
28 | 28 | import org.elasticsearch.rest.RestUtils; |
| 29 | +import org.elasticsearch.test.fixture.AbstractHttpFixture; |
29 | 30 |
|
30 | 31 | import java.io.BufferedInputStream; |
31 | 32 | import java.io.ByteArrayInputStream; |
@@ -93,23 +94,21 @@ protected Response handle(final Request request) throws IOException { |
93 | 94 | return newError(request.getId(), RestStatus.FORBIDDEN, "AccessDenied", "Bad access key", ""); |
94 | 95 | } |
95 | 96 |
|
96 | | - if (handler != null) { |
97 | | - final String bucket = request.getParam("bucket"); |
98 | | - if (bucket != null && permittedBucket.equals(bucket) == false) { |
99 | | - // allow a null bucket to support the multi-object-delete API which |
100 | | - // passes the bucket name in the host header instead of the URL. |
101 | | - if (buckets.containsKey(bucket)) { |
102 | | - return newError(request.getId(), RestStatus.FORBIDDEN, "AccessDenied", "Bad bucket", ""); |
103 | | - } else { |
104 | | - return newBucketNotFoundError(request.getId(), bucket); |
105 | | - } |
| 97 | + final String bucket = request.getParam("bucket"); |
| 98 | + if (bucket != null && permittedBucket.equals(bucket) == false) { |
| 99 | + // allow a null bucket to support the multi-object-delete API which |
| 100 | + // passes the bucket name in the host header instead of the URL. |
| 101 | + if (buckets.containsKey(bucket)) { |
| 102 | + return newError(request.getId(), RestStatus.FORBIDDEN, "AccessDenied", "Bad bucket", ""); |
| 103 | + } else { |
| 104 | + return newBucketNotFoundError(request.getId(), bucket); |
106 | 105 | } |
107 | | - return handler.handle(request); |
108 | | - } else { |
109 | | - return newInternalError(request.getId(), "No handler defined for request [" + request + "]"); |
110 | 106 | } |
| 107 | + return handler.handle(request); |
| 108 | + |
| 109 | + } else { |
| 110 | + return newInternalError(request.getId(), "No handler defined for request [" + request + "]"); |
111 | 111 | } |
112 | | - return null; |
113 | 112 | } |
114 | 113 |
|
115 | 114 | public static void main(final String[] args) throws Exception { |
|
0 commit comments