1
mirror of https://github.com/rclone/rclone synced 2024-12-27 19:43:48 +01:00

crypt: correctly handle trailing dot

This commit is contained in:
buengese 2020-01-21 22:32:34 +01:00 committed by buengese
parent 7125cb10f5
commit 9c858c3228

View File

@ -5,6 +5,7 @@ import (
"context" "context"
"fmt" "fmt"
"io" "io"
"path"
"strings" "strings"
"time" "time"
@ -144,6 +145,10 @@ func NewFs(name, rpath string, m configmap.Mapper) (fs.Fs, error) {
if err != nil { if err != nil {
return nil, errors.Wrapf(err, "failed to parse remote %q to wrap", remote) return nil, errors.Wrapf(err, "failed to parse remote %q to wrap", remote)
} }
// Make sure to remove trailing . reffering to the current dir
if path.Base(rpath) == "." {
rpath = strings.TrimSuffix(rpath, ".")
}
// Look for a file first // Look for a file first
remotePath := fspath.JoinRootPath(wPath, cipher.EncryptFileName(rpath)) remotePath := fspath.JoinRootPath(wPath, cipher.EncryptFileName(rpath))
wrappedFs, err := wInfo.NewFs(wName, remotePath, wConfig) wrappedFs, err := wInfo.NewFs(wName, remotePath, wConfig)