mirror of
https://github.com/rclone/rclone.git
synced 2025-06-20 19:57:51 +02:00
s3: fix directory marker after // changes in #5858
Before this change we were creating the directory markers with double slashes on.
This commit is contained in:
parent
073184132e
commit
1dc3421c7f
@ -3136,6 +3136,9 @@ func parsePath(path string) (root string) {
|
|||||||
// relative to f.root
|
// relative to f.root
|
||||||
func (f *Fs) split(rootRelativePath string) (bucketName, bucketPath string) {
|
func (f *Fs) split(rootRelativePath string) (bucketName, bucketPath string) {
|
||||||
bucketName, bucketPath = bucket.Split(bucket.Join(f.root, rootRelativePath))
|
bucketName, bucketPath = bucket.Split(bucket.Join(f.root, rootRelativePath))
|
||||||
|
if f.opt.DirectoryMarkers && strings.HasSuffix(bucketPath, "//") {
|
||||||
|
bucketPath = bucketPath[:len(bucketPath)-1]
|
||||||
|
}
|
||||||
return f.opt.Enc.FromStandardName(bucketName), f.opt.Enc.FromStandardPath(bucketPath)
|
return f.opt.Enc.FromStandardName(bucketName), f.opt.Enc.FromStandardPath(bucketPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4458,7 +4461,7 @@ func (f *Fs) list(ctx context.Context, opt listOpt, fn listFn) error {
|
|||||||
remote = remote[len(opt.prefix):]
|
remote = remote[len(opt.prefix):]
|
||||||
if isDirectory {
|
if isDirectory {
|
||||||
// process directory markers as directories
|
// process directory markers as directories
|
||||||
remote = strings.TrimRight(remote, "/")
|
remote, _ = strings.CutSuffix(remote, "/")
|
||||||
}
|
}
|
||||||
if opt.addBucket {
|
if opt.addBucket {
|
||||||
remote = bucket.Join(opt.bucket, remote)
|
remote = bucket.Join(opt.bucket, remote)
|
||||||
@ -4773,7 +4776,7 @@ func (f *Fs) Mkdir(ctx context.Context, dir string) error {
|
|||||||
|
|
||||||
// mkdirParent creates the parent bucket/directory if it doesn't exist
|
// mkdirParent creates the parent bucket/directory if it doesn't exist
|
||||||
func (f *Fs) mkdirParent(ctx context.Context, remote string) error {
|
func (f *Fs) mkdirParent(ctx context.Context, remote string) error {
|
||||||
remote = strings.TrimRight(remote, "/")
|
remote, _ = strings.CutSuffix(remote, "/")
|
||||||
dir := path.Dir(remote)
|
dir := path.Dir(remote)
|
||||||
if dir == "/" || dir == "." {
|
if dir == "/" || dir == "." {
|
||||||
dir = ""
|
dir = ""
|
||||||
|
@ -230,8 +230,6 @@ backends:
|
|||||||
- backend: "s3"
|
- backend: "s3"
|
||||||
remote: "TestS3,directory_markers:"
|
remote: "TestS3,directory_markers:"
|
||||||
fastlist: true
|
fastlist: true
|
||||||
ignoretests:
|
|
||||||
- cmd/bisync
|
|
||||||
- backend: "s3"
|
- backend: "s3"
|
||||||
remote: "TestS3Rclone:"
|
remote: "TestS3Rclone:"
|
||||||
fastlist: true
|
fastlist: true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user