summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2020-04-09 14:37:01 +0200
committerMorris Jobke <hey@morrisjobke.de>2020-05-22 15:29:43 +0200
commit3d3ee1bfaefb16a5fe912932abff90bf972f3736 (patch)
tree7d0098f5a0607416467b1241307f1c2488991fba
parent25f5a5e5757f1a1ac6af0bd94bf78066163d927f (diff)
downloadnextcloud-server-3d3ee1bfaefb16a5fe912932abff90bf972f3736.tar.gz
nextcloud-server-3d3ee1bfaefb16a5fe912932abff90bf972f3736.zip
harden seekable http stream a bit against failures
Signed-off-by: Robin Appelman <robin@icewind.nl>
-rw-r--r--lib/private/Files/Stream/SeekableHttpStream.php16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/private/Files/Stream/SeekableHttpStream.php b/lib/private/Files/Stream/SeekableHttpStream.php
index fdcd9ea8cfb..113ba19a17a 100644
--- a/lib/private/Files/Stream/SeekableHttpStream.php
+++ b/lib/private/Files/Stream/SeekableHttpStream.php
@@ -149,15 +149,25 @@ class SeekableHttpStream implements File {
}
public function stream_stat() {
- return fstat($this->current);
+ if (is_resource($this->current)) {
+ return fstat($this->current);
+ } else {
+ return false;
+ }
}
public function stream_eof() {
- return feof($this->current);
+ if (is_resource($this->current)) {
+ return feof($this->current);
+ } else {
+ return true;
+ }
}
public function stream_close() {
- fclose($this->current);
+ if (is_resource($this->current)) {
+ fclose($this->current);
+ }
}
public function stream_write($data) {