summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2022-06-09 09:49:55 +0200
committerGitHub <noreply@github.com>2022-06-09 09:49:55 +0200
commit42f92153f5ff91699025e5ac692764619f6a60f9 (patch)
tree844a7910dd375df52e2b73df9583ab1897d28896 /lib
parentda58e46ecded68585f6ce3c5ce778be076711b1a (diff)
parent499995b37a6a761cead629a64dd216eeac794619 (diff)
downloadnextcloud-server-42f92153f5ff91699025e5ac692764619f6a60f9.tar.gz
nextcloud-server-42f92153f5ff91699025e5ac692764619f6a60f9.zip
Merge pull request #32767 from nextcloud/seeakble-http-stream-wrappers
handle stream wrappers in SeekableHttpStream
Diffstat (limited to 'lib')
-rw-r--r--lib/private/Files/Stream/SeekableHttpStream.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/private/Files/Stream/SeekableHttpStream.php b/lib/private/Files/Stream/SeekableHttpStream.php
index af797c7720d..820a681bd07 100644
--- a/lib/private/Files/Stream/SeekableHttpStream.php
+++ b/lib/private/Files/Stream/SeekableHttpStream.php
@@ -24,6 +24,7 @@
namespace OC\Files\Stream;
use Icewind\Streams\File;
+use Icewind\Streams\Wrapper;
/**
* A stream wrapper that uses http range requests to provide a seekable stream for http reading
@@ -92,6 +93,18 @@ class SeekableHttpStream implements File {
}
$responseHead = stream_get_meta_data($this->current)['wrapper_data'];
+
+ while ($responseHead instanceof Wrapper) {
+ $wrapperOptions = stream_context_get_options($responseHead->context);
+ foreach ($wrapperOptions as $options) {
+ if (isset($options['source']) && is_resource($options['source'])) {
+ $responseHead = stream_get_meta_data($options['source'])['wrapper_data'];
+ continue 2;
+ }
+ }
+ throw new \Exception("Failed to get source stream from stream wrapper of " . get_class($responseHead));
+ }
+
$rangeHeaders = array_values(array_filter($responseHead, function ($v) {
return preg_match('#^content-range:#i', $v) === 1;
}));