summaryrefslogtreecommitdiffstats
path: root/lib/private/files
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-12-11 10:48:22 +0100
committerThomas Müller <thomas.mueller@tmit.eu>2015-12-11 10:48:22 +0100
commitecc3c174a0eed6d9fd286ed175987712d227ceaf (patch)
tree385424fde51e0c5b2ceab52a7dbd7ae1f9ec4a83 /lib/private/files
parentc022128630675a199cd8fb839af74159391c0749 (diff)
parent97f5c095f4018119e15d7c612a685da1dc91a340 (diff)
downloadnextcloud-server-ecc3c174a0eed6d9fd286ed175987712d227ceaf.tar.gz
nextcloud-server-ecc3c174a0eed6d9fd286ed175987712d227ceaf.zip
Merge pull request #21128 from owncloud/dav-fopen-non-existing
Dont do a seperate request to check if a file exists when downloading a file from dav external storage
Diffstat (limited to 'lib/private/files')
-rw-r--r--lib/private/files/storage/dav.php22
1 files changed, 14 insertions, 8 deletions
diff --git a/lib/private/files/storage/dav.php b/lib/private/files/storage/dav.php
index dda163e41a0..9afebab1dd7 100644
--- a/lib/private/files/storage/dav.php
+++ b/lib/private/files/storage/dav.php
@@ -34,6 +34,7 @@
namespace OC\Files\Storage;
use Exception;
+use GuzzleHttp\Exception\RequestException;
use OC\Files\Filesystem;
use OC\Files\Stream\Close;
use Icewind\Streams\IteratorDirectory;
@@ -339,15 +340,20 @@ class DAV extends Common {
switch ($mode) {
case 'r':
case 'rb':
- if (!$this->file_exists($path)) {
- return false;
+ try {
+ $response = $this->httpClientService
+ ->newClient()
+ ->get($this->createBaseUri() . $this->encodePath($path), [
+ 'auth' => [$this->user, $this->password],
+ 'stream' => true
+ ]);
+ } catch (RequestException $e) {
+ if ($e->getResponse()->getStatusCode() === 404) {
+ return false;
+ } else {
+ throw $e;
+ }
}
- $response = $this->httpClientService
- ->newClient()
- ->get($this->createBaseUri() . $this->encodePath($path), [
- 'auth' => [$this->user, $this->password],
- 'stream' => true
- ]);
if ($response->getStatusCode() !== Http::STATUS_OK) {
if ($response->getStatusCode() === Http::STATUS_LOCKED) {