mirror of https://github.com/apache/jclouds.git
Tolerate oversized ranges in getBlob
This commit is contained in:
parent
c223f73762
commit
f55231d607
|
@ -560,9 +560,12 @@ public class FilesystemAsyncBlobStore extends BaseAsyncBlobStore {
|
||||||
return immediateFailedFuture(new IllegalArgumentException("illegal range: " + s));
|
return immediateFailedFuture(new IllegalArgumentException("illegal range: " + s));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (offset > last || last + 1 > data.length) {
|
if (offset > last) {
|
||||||
return immediateFailedFuture(new IllegalArgumentException("illegal range: " + s));
|
return immediateFailedFuture(new IllegalArgumentException("illegal range: " + s));
|
||||||
}
|
}
|
||||||
|
if (last + 1 > data.length) {
|
||||||
|
last = data.length - 1;
|
||||||
|
}
|
||||||
out.write(data, offset, last - offset + 1);
|
out.write(data, offset, last - offset + 1);
|
||||||
}
|
}
|
||||||
ContentMetadata cmd = blob.getPayload().getContentMetadata();
|
ContentMetadata cmd = blob.getPayload().getContentMetadata();
|
||||||
|
|
|
@ -606,9 +606,12 @@ public class TransientAsyncBlobStore extends BaseAsyncBlobStore {
|
||||||
return immediateFailedFuture(new IllegalArgumentException("illegal range: " + s));
|
return immediateFailedFuture(new IllegalArgumentException("illegal range: " + s));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (offset > last || last + 1 > data.length) {
|
if (offset > last) {
|
||||||
return immediateFailedFuture(new IllegalArgumentException("illegal range: " + s));
|
return immediateFailedFuture(new IllegalArgumentException("illegal range: " + s));
|
||||||
}
|
}
|
||||||
|
if (last + 1 > data.length) {
|
||||||
|
last = data.length - 1;
|
||||||
|
}
|
||||||
out.write(data, offset, last - offset + 1);
|
out.write(data, offset, last - offset + 1);
|
||||||
}
|
}
|
||||||
ContentMetadata cmd = blob.getPayload().getContentMetadata();
|
ContentMetadata cmd = blob.getPayload().getContentMetadata();
|
||||||
|
|
Loading…
Reference in New Issue