Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Chemineau <louis@chmn.me>2022-02-16 16:56:14 +0300
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2022-02-21 17:25:54 +0300
commit5043a9dc6b76193b27456002eb0afdc5378c878d (patch)
treef80312a2e29d51ce812efbc617555e712e53b159 /apps/dav/lib
parent7a2697a10030e970c7751892d1dd60bcd726a073 (diff)
Wrap S3 multipart upload exception
Signed-off-by: Louis Chemineau <louis@chmn.me>
Diffstat (limited to 'apps/dav/lib')
-rw-r--r--apps/dav/lib/Connector/Sabre/Exception/BadGateway.php40
-rw-r--r--apps/dav/lib/Connector/Sabre/File.php3
2 files changed, 43 insertions, 0 deletions
diff --git a/apps/dav/lib/Connector/Sabre/Exception/BadGateway.php b/apps/dav/lib/Connector/Sabre/Exception/BadGateway.php
new file mode 100644
index 00000000000..c4cd6db190a
--- /dev/null
+++ b/apps/dav/lib/Connector/Sabre/Exception/BadGateway.php
@@ -0,0 +1,40 @@
+<?php
+/**
+ * @copyright Copyright (c) 2021, Louis Chemineau <louis@chmn.me>
+ *
+ * @author Louis Chemineau <louis@chmn.me>
+ *
+ * @license AGPL-3.0
+ *
+ * This code is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License, version 3,
+ * along with this program. If not, see <http://www.gnu.org/licenses/>
+ *
+ */
+namespace OCA\DAV\Connector\Sabre\Exception;
+
+/**
+ * Bad Gateway
+ *
+ * This exception is thrown whenever the server, while acting as a gateway or proxy, received an invalid response from the upstream server.
+ *
+ */
+class BadGateway extends \Sabre\DAV\Exception {
+
+ /**
+ * Returns the HTTP status code for this exception
+ *
+ * @return int
+ */
+ public function getHTTPCode() {
+ return 502;
+ }
+}
diff --git a/apps/dav/lib/Connector/Sabre/File.php b/apps/dav/lib/Connector/Sabre/File.php
index 5ff5f831eb5..28817b93b76 100644
--- a/apps/dav/lib/Connector/Sabre/File.php
+++ b/apps/dav/lib/Connector/Sabre/File.php
@@ -47,6 +47,7 @@ use OCA\DAV\Connector\Sabre\Exception\EntityTooLarge;
use OCA\DAV\Connector\Sabre\Exception\FileLocked;
use OCA\DAV\Connector\Sabre\Exception\Forbidden as DAVForbiddenException;
use OCA\DAV\Connector\Sabre\Exception\UnsupportedMediaType;
+use OCA\DAV\Connector\Sabre\Exception\BadGateway;
use OCP\Encryption\Exceptions\GenericEncryptionException;
use OCP\Files\EntityTooLargeException;
use OCP\Files\FileInfo;
@@ -206,6 +207,8 @@ class File extends Node implements IFile {
$count = $partStorage->writeStream($internalPartPath, $wrappedData);
} catch (GenericFileException $e) {
$result = false;
+ } catch (BadGateway $e) {
+ throw $e;
}