mirror of
https://github.com/nextcloud/server.git
synced 2026-06-13 18:50:47 -04:00
Merge pull request #50514 from nextcloud/feat/s3/sse-c
feat(S3): add SSE-C support in S3 External Storage
This commit is contained in:
commit
3f45bc5ed3
3 changed files with 7 additions and 4 deletions
|
|
@ -41,6 +41,9 @@ class AmazonS3 extends Backend {
|
|||
(new DefinitionParameter('useMultipartCopy', $l->t('Enable multipart copy')))
|
||||
->setType(DefinitionParameter::VALUE_BOOLEAN)
|
||||
->setDefaultValue(true),
|
||||
(new DefinitionParameter('sse_c_key', $l->t('SSE-C encryption key')))
|
||||
->setType(DefinitionParameter::VALUE_PASSWORD)
|
||||
->setFlag(DefinitionParameter::FLAG_OPTIONAL),
|
||||
])
|
||||
->addAuthScheme(AccessKey::SCHEME_AMAZONS3_ACCESSKEY)
|
||||
->addAuthScheme(AuthMechanism::SCHEME_NULL)
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ class AmazonS3 extends Common {
|
|||
$this->objectCache[$key] = $this->getConnection()->headObject([
|
||||
'Bucket' => $this->bucket,
|
||||
'Key' => $key
|
||||
])->toArray();
|
||||
] + $this->getSSECParameters())->toArray();
|
||||
} catch (S3Exception $e) {
|
||||
if ($e->getStatusCode() >= 500) {
|
||||
throw $e;
|
||||
|
|
@ -207,7 +207,7 @@ class AmazonS3 extends Common {
|
|||
'Key' => $path . '/',
|
||||
'Body' => '',
|
||||
'ContentType' => FileInfo::MIMETYPE_FOLDER
|
||||
]);
|
||||
] + $this->getSSECParameters());
|
||||
$this->testTimeout();
|
||||
} catch (S3Exception $e) {
|
||||
$this->logger->error($e->getMessage(), [
|
||||
|
|
@ -507,7 +507,7 @@ class AmazonS3 extends Common {
|
|||
'Body' => '',
|
||||
'ContentType' => $mimeType,
|
||||
'MetadataDirective' => 'REPLACE',
|
||||
]);
|
||||
] + $this->getSSECParameters());
|
||||
$this->testTimeout();
|
||||
} catch (S3Exception $e) {
|
||||
$this->logger->error($e->getMessage(), [
|
||||
|
|
|
|||
|
|
@ -213,7 +213,7 @@ trait S3ConnectionTrait {
|
|||
}
|
||||
|
||||
protected function getSSECKey(): ?string {
|
||||
if (isset($this->params['sse_c_key'])) {
|
||||
if (isset($this->params['sse_c_key']) && !empty($this->params['sse_c_key'])) {
|
||||
return $this->params['sse_c_key'];
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue