summaryrefslogtreecommitdiffstats
path: root/lib/private/Files
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2019-11-20 12:32:00 +0100
committerGitHub <noreply@github.com>2019-11-20 12:32:00 +0100
commitd625d8bd1e07034816642937ed5d5fe3dc40d659 (patch)
tree711e344733e5cb5e5a042b616420b5c9ad095172 /lib/private/Files
parent6ad54f3f27298a8f2f62fba67344a529f071510f (diff)
parentc08e803db305edb06bf6a0857a37689bcc19e613 (diff)
downloadnextcloud-server-d625d8bd1e07034816642937ed5d5fe3dc40d659.tar.gz
nextcloud-server-d625d8bd1e07034816642937ed5d5fe3dc40d659.zip
Merge pull request #17824 from nextcloud/fix/dav/catch_forbidden
Catch forbidden http status code
Diffstat (limited to 'lib/private/Files')
-rw-r--r--lib/private/Files/Storage/DAV.php5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/private/Files/Storage/DAV.php b/lib/private/Files/Storage/DAV.php
index c4ebb0a44dc..2367c1aab3c 100644
--- a/lib/private/Files/Storage/DAV.php
+++ b/lib/private/Files/Storage/DAV.php
@@ -35,6 +35,7 @@ namespace OC\Files\Storage;
use Exception;
use GuzzleHttp\Exception\RequestException;
+use OCP\Files\ForbiddenException;
use OCP\ILogger;
use Psr\Http\Message\ResponseInterface;
use Icewind\Streams\CallbackWrapper;
@@ -829,6 +830,7 @@ class DAV extends Common {
* when the authentication expired or is invalid
* @throws StorageNotAvailableException if the storage is not available,
* which might be temporary
+ * @throws ForbiddenException if the action is not allowed
*/
protected function convertException(Exception $e, $path = '') {
\OC::$server->getLogger()->logException($e, ['app' => 'files_external', 'level' => ILogger::DEBUG]);
@@ -842,6 +844,9 @@ class DAV extends Common {
} else if ($e->getHttpStatus() === Http::STATUS_METHOD_NOT_ALLOWED) {
// ignore exception for MethodNotAllowed, false will be returned
return;
+ } else if ($e->getHttpStatus() === Http::STATUS_FORBIDDEN){
+ // The operation is forbidden. Fail somewhat gracefully
+ throw new ForbiddenException(get_class($e) . ':' . $e->getMessage());
}
throw new StorageNotAvailableException(get_class($e) . ': ' . $e->getMessage());
} else if ($e instanceof ClientException) {