aboutsummaryrefslogtreecommitdiff
path: root/weed/sftpd/user/filestore.go
diff options
context:
space:
mode:
Diffstat (limited to 'weed/sftpd/user/filestore.go')
-rw-r--r--weed/sftpd/user/filestore.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/weed/sftpd/user/filestore.go b/weed/sftpd/user/filestore.go
index c522a388a..4c372aa76 100644
--- a/weed/sftpd/user/filestore.go
+++ b/weed/sftpd/user/filestore.go
@@ -5,6 +5,7 @@ import (
"encoding/json"
"fmt"
"os"
+ "path"
"sync"
"golang.org/x/crypto/ssh"
@@ -99,6 +100,10 @@ func (s *FileStore) loadUsers() error {
user.PublicKeys[i] = string(pubKey.Marshal())
}
}
+ // Clean HomeDir to handle trailing slashes and normalize path
+ if user.HomeDir != "" {
+ user.HomeDir = path.Clean(user.HomeDir)
+ }
s.users[user.Username] = user
}