Handle illegal ranges in range requests

pull/64/head
Andrew Gaul 2015-06-16 21:36:07 -07:00
rodzic 2e400fb273
commit 4b01ffbba2
2 zmienionych plików z 8 dodań i 1 usunięć

Wyświetl plik

@ -49,6 +49,8 @@ enum S3ErrorCode {
"The specified location constraint is not valid. For" +
" more information about Regions, see How to Select" +
" a Region for Your Buckets."),
INVALID_RANGE(HttpServletResponse.SC_REQUESTED_RANGE_NOT_SATISFIABLE,
"The requested range is not satisfiable"),
INVALID_PART(HttpServletResponse.SC_BAD_REQUEST,
"One or more of the specified parts could not be found." +
" The part may not have been uploaded, or the specified entity" +

Wyświetl plik

@ -967,7 +967,12 @@ final class S3ProxyHandler extends AbstractHandler {
status = HttpServletResponse.SC_PARTIAL_CONTENT;
}
Blob blob = blobStore.getBlob(containerName, blobName, options);
Blob blob;
try {
blob = blobStore.getBlob(containerName, blobName, options);
} catch (IllegalArgumentException iae) {
throw new S3Exception(S3ErrorCode.INVALID_RANGE);
}
if (blob == null) {
throw new S3Exception(S3ErrorCode.NO_SUCH_KEY);
}