MM-40752 - set encryption when copying files to minio honoring config defined value (#19251)
Co-authored-by: Pablo Velez Vidal <pablo.velez@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
95fd120670
Коммит
f4809def78
@@ -255,18 +255,25 @@ func (b *S3FileBackend) CopyFile(oldPath, newPath string) error {
|
|||||||
oldPath = filepath.Join(b.pathPrefix, oldPath)
|
oldPath = filepath.Join(b.pathPrefix, oldPath)
|
||||||
newPath = filepath.Join(b.pathPrefix, newPath)
|
newPath = filepath.Join(b.pathPrefix, newPath)
|
||||||
srcOpts := s3.CopySrcOptions{
|
srcOpts := s3.CopySrcOptions{
|
||||||
Bucket: b.bucket,
|
Bucket: b.bucket,
|
||||||
Object: oldPath,
|
Object: oldPath,
|
||||||
Encryption: encrypt.NewSSE(),
|
|
||||||
}
|
}
|
||||||
|
if b.encrypt {
|
||||||
|
srcOpts.Encryption = encrypt.NewSSE()
|
||||||
|
}
|
||||||
|
|
||||||
dstOpts := s3.CopyDestOptions{
|
dstOpts := s3.CopyDestOptions{
|
||||||
Bucket: b.bucket,
|
Bucket: b.bucket,
|
||||||
Object: newPath,
|
Object: newPath,
|
||||||
Encryption: encrypt.NewSSE(),
|
|
||||||
}
|
}
|
||||||
|
if b.encrypt {
|
||||||
|
dstOpts.Encryption = encrypt.NewSSE()
|
||||||
|
}
|
||||||
|
|
||||||
if _, err := b.client.CopyObject(context.Background(), dstOpts, srcOpts); err != nil {
|
if _, err := b.client.CopyObject(context.Background(), dstOpts, srcOpts); err != nil {
|
||||||
return errors.Wrapf(err, "unable to copy file from %s to %s", oldPath, newPath)
|
return errors.Wrapf(err, "unable to copy file from %s to %s", oldPath, newPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -274,14 +281,19 @@ func (b *S3FileBackend) MoveFile(oldPath, newPath string) error {
|
|||||||
oldPath = filepath.Join(b.pathPrefix, oldPath)
|
oldPath = filepath.Join(b.pathPrefix, oldPath)
|
||||||
newPath = filepath.Join(b.pathPrefix, newPath)
|
newPath = filepath.Join(b.pathPrefix, newPath)
|
||||||
srcOpts := s3.CopySrcOptions{
|
srcOpts := s3.CopySrcOptions{
|
||||||
Bucket: b.bucket,
|
Bucket: b.bucket,
|
||||||
Object: oldPath,
|
Object: oldPath,
|
||||||
Encryption: encrypt.NewSSE(),
|
|
||||||
}
|
}
|
||||||
|
if b.encrypt {
|
||||||
|
srcOpts.Encryption = encrypt.NewSSE()
|
||||||
|
}
|
||||||
|
|
||||||
dstOpts := s3.CopyDestOptions{
|
dstOpts := s3.CopyDestOptions{
|
||||||
Bucket: b.bucket,
|
Bucket: b.bucket,
|
||||||
Object: newPath,
|
Object: newPath,
|
||||||
Encryption: encrypt.NewSSE(),
|
}
|
||||||
|
if b.encrypt {
|
||||||
|
dstOpts.Encryption = encrypt.NewSSE()
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err := b.client.CopyObject(context.Background(), dstOpts, srcOpts); err != nil {
|
if _, err := b.client.CopyObject(context.Background(), dstOpts, srcOpts); err != nil {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user