mirror of
https://github.com/drakkan/sftpgo.git
synced 2025-12-07 23:00:55 +03:00
S3fs: Handle non-ascii filename in rename operations (#257)
SFTP is based on UTF-8 filenames, so non-ASCII filenames get transported with utf-8 escaped character sequences. At least for the S3fs provider, if such a file is stored in a nested path it cannot be used as the source for a rename operations. This adds the necessary escaping of the path fragments. The patch is not required for MinIO but it doesn't hurt
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"mime"
|
||||
"net/url"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
@@ -297,7 +298,7 @@ func (fs *S3Fs) Rename(source, target string) error {
|
||||
defer cancelFn()
|
||||
_, err = fs.svc.CopyObjectWithContext(ctx, &s3.CopyObjectInput{
|
||||
Bucket: aws.String(fs.config.Bucket),
|
||||
CopySource: aws.String(copySource),
|
||||
CopySource: aws.String(url.PathEscape(copySource)),
|
||||
Key: aws.String(target),
|
||||
StorageClass: utils.NilIfEmpty(fs.config.StorageClass),
|
||||
ContentType: utils.NilIfEmpty(contentType),
|
||||
|
||||
Reference in New Issue
Block a user