diff options
author | Robin Appelman <robin@icewind.nl> | 2023-05-12 17:52:04 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2023-06-09 18:08:18 +0200 |
commit | ea88ec1350ec0a155dfbb2afda52f60fa834f87d (patch) | |
tree | 18a36fa9bbd6a0f7f2fdc4fd6531f8c006ca829e /lib | |
parent | faf0e634db6d08ca354578d93a52d07245b60404 (diff) | |
download | nextcloud-server-ea88ec1350ec0a155dfbb2afda52f60fa834f87d.tar.gz nextcloud-server-ea88ec1350ec0a155dfbb2afda52f60fa834f87d.zip |
add utility command for object store objects
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Files/ObjectStore/S3ObjectTrait.php | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/private/Files/ObjectStore/S3ObjectTrait.php b/lib/private/Files/ObjectStore/S3ObjectTrait.php index 8fa6d67faa3..e0d0f2ce9c7 100644 --- a/lib/private/Files/ObjectStore/S3ObjectTrait.php +++ b/lib/private/Files/ObjectStore/S3ObjectTrait.php @@ -54,7 +54,7 @@ trait S3ObjectTrait { * @since 7.0.0 */ public function readObject($urn) { - return SeekableHttpStream::open(function ($range) use ($urn) { + $fh = SeekableHttpStream::open(function ($range) use ($urn) { $command = $this->getConnection()->getCommand('GetObject', [ 'Bucket' => $this->bucket, 'Key' => $urn, @@ -88,6 +88,10 @@ trait S3ObjectTrait { $context = stream_context_create($opts); return fopen($request->getUri(), 'r', false, $context); }); + if (!$fh) { + throw new \Exception("Failed to read object $urn"); + } + return $fh; } |