kopia lustrzana https://github.com/gaul/s3proxy
Handle illegal ranges in range requests
rodzic
2e400fb273
commit
4b01ffbba2
|
@ -49,6 +49,8 @@ enum S3ErrorCode {
|
||||||
"The specified location constraint is not valid. For" +
|
"The specified location constraint is not valid. For" +
|
||||||
" more information about Regions, see How to Select" +
|
" more information about Regions, see How to Select" +
|
||||||
" a Region for Your Buckets."),
|
" 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,
|
INVALID_PART(HttpServletResponse.SC_BAD_REQUEST,
|
||||||
"One or more of the specified parts could not be found." +
|
"One or more of the specified parts could not be found." +
|
||||||
" The part may not have been uploaded, or the specified entity" +
|
" The part may not have been uploaded, or the specified entity" +
|
||||||
|
|
|
@ -967,7 +967,12 @@ final class S3ProxyHandler extends AbstractHandler {
|
||||||
status = HttpServletResponse.SC_PARTIAL_CONTENT;
|
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) {
|
if (blob == null) {
|
||||||
throw new S3Exception(S3ErrorCode.NO_SUCH_KEY);
|
throw new S3Exception(S3ErrorCode.NO_SUCH_KEY);
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue