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
path: root/apps
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2022-06-10 12:24:46 +0300
committerGitHub <noreply@github.com>2022-06-10 12:24:46 +0300
commit5b9ec0591279d1af45825fcc6dede917f8abf805 (patch)
tree00f486b2af59233842248c0ccc2e4c96e156801d /apps
parent3a3c3b5e1d25a07412203e897b7ec2e78b41982b (diff)
parent43e8f89a2180f73d926f16ac9c4322004753664d (diff)
Merge pull request #32758 from nextcloud/backport/stable24/upload-speed
[stable24] Make X-HAS-{MD5/SHA256} opt-in
Diffstat (limited to 'apps')
-rw-r--r--apps/dav/lib/Connector/Sabre/File.php29
1 files changed, 20 insertions, 9 deletions
diff --git a/apps/dav/lib/Connector/Sabre/File.php b/apps/dav/lib/Connector/Sabre/File.php
index 6c379984995..00c7c779eee 100644
--- a/apps/dav/lib/Connector/Sabre/File.php
+++ b/apps/dav/lib/Connector/Sabre/File.php
@@ -215,15 +215,26 @@ class File extends Node implements IFile {
$data = $tmpData;
}
- $data = HashWrapper::wrap($data, 'md5', function ($hash) {
- $this->header('X-Hash-MD5: ' . $hash);
- });
- $data = HashWrapper::wrap($data, 'sha1', function ($hash) {
- $this->header('X-Hash-SHA1: ' . $hash);
- });
- $data = HashWrapper::wrap($data, 'sha256', function ($hash) {
- $this->header('X-Hash-SHA256: ' . $hash);
- });
+ if ($this->request->getHeader('X-HASH') !== '') {
+ $hash = $this->request->getHeader('X-HASH');
+ if ($hash === 'all' || $hash === 'md5') {
+ $data = HashWrapper::wrap($data, 'md5', function ($hash) {
+ $this->header('X-Hash-MD5: ' . $hash);
+ });
+ }
+
+ if ($hash === 'all' || $hash === 'sha1') {
+ $data = HashWrapper::wrap($data, 'sha1', function ($hash) {
+ $this->header('X-Hash-SHA1: ' . $hash);
+ });
+ }
+
+ if ($hash === 'all' || $hash === 'sha256') {
+ $data = HashWrapper::wrap($data, 'sha256', function ($hash) {
+ $this->header('X-Hash-SHA256: ' . $hash);
+ });
+ }
+ }
if ($partStorage->instanceOfStorage(Storage\IWriteStreamStorage::class)) {
$isEOF = false;