Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable23] Make X-HAS-{MD5/SHA256} opt-in #32759

Merged
merged 1 commit into from
Jun 10, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 20 additions & 9 deletions apps/dav/lib/Connector/Sabre/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,15 +212,26 @@ public function put($data) {
$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) {

Check notice

Code scanning / Psalm

MissingClosureParamType

Parameter $hash has no provided type
$this->header('X-Hash-MD5: ' . $hash);
});
}

if ($hash === 'all' || $hash === 'sha1') {
$data = HashWrapper::wrap($data, 'sha1', function ($hash) {

Check notice

Code scanning / Psalm

MissingClosureParamType

Parameter $hash has no provided type
$this->header('X-Hash-SHA1: ' . $hash);
});
}

if ($hash === 'all' || $hash === 'sha256') {
$data = HashWrapper::wrap($data, 'sha256', function ($hash) {

Check notice

Code scanning / Psalm

MissingClosureParamType

Parameter $hash has no provided type
$this->header('X-Hash-SHA256: ' . $hash);
});
}
}

if ($partStorage->instanceOfStorage(Storage\IWriteStreamStorage::class)) {
$isEOF = false;
Expand Down