aboutsummaryrefslogtreecommitdiff
path: root/internal/fusefrontend_reverse
diff options
context:
space:
mode:
Diffstat (limited to 'internal/fusefrontend_reverse')
-rw-r--r--internal/fusefrontend_reverse/reverse_longnames.go2
-rw-r--r--internal/fusefrontend_reverse/rpath.go13
-rw-r--r--internal/fusefrontend_reverse/virtualfile.go3
3 files changed, 5 insertions, 13 deletions
diff --git a/internal/fusefrontend_reverse/reverse_longnames.go b/internal/fusefrontend_reverse/reverse_longnames.go
index 3b2ddea..ec164f1 100644
--- a/internal/fusefrontend_reverse/reverse_longnames.go
+++ b/internal/fusefrontend_reverse/reverse_longnames.go
@@ -86,7 +86,7 @@ func (rfs *ReverseFS) newNameFile(relPath string) (nodefs.File, fuse.Status) {
dotName := filepath.Base(relPath) // gocryptfs.longname.XYZ.name
longname := dotName[:len(dotName)-len(nametransform.LongNameSuffix)] // gocryptfs.longname.XYZ
// cipher directory
- cDir := saneDir(relPath)
+ cDir := nametransform.Dir(relPath)
// plain directory
pDir, err := rfs.decryptPath(cDir)
if err != nil {
diff --git a/internal/fusefrontend_reverse/rpath.go b/internal/fusefrontend_reverse/rpath.go
index 6f6895a..fa7680f 100644
--- a/internal/fusefrontend_reverse/rpath.go
+++ b/internal/fusefrontend_reverse/rpath.go
@@ -11,15 +11,6 @@ import (
"github.com/rfjakob/gocryptfs/internal/tlog"
)
-// saneDir is like filepath.Dir but returns "" instead of "."
-func saneDir(path string) string {
- d := filepath.Dir(path)
- if d == "." {
- return ""
- }
- return d
-}
-
// abs basically returns storage dir + "/" + relPath.
// It takes an error parameter so it can directly wrap decryptPath like this:
// a, err := rfs.abs(rfs.decryptPath(relPath))
@@ -71,7 +62,7 @@ func (rfs *ReverseFS) decryptPath(relPath string) (string, error) {
return relPath, nil
}
// Check if the parent dir is in the cache
- cDir := saneDir(relPath)
+ cDir := nametransform.Dir(relPath)
dirIV, pDir := rPathCache.lookup(cDir)
if dirIV != nil {
cName := filepath.Base(relPath)
@@ -95,6 +86,6 @@ func (rfs *ReverseFS) decryptPath(relPath string) (string, error) {
transformedParts = append(transformedParts, transformedPart)
}
pRelPath := filepath.Join(transformedParts...)
- rPathCache.store(cDir, dirIV, saneDir(pRelPath))
+ rPathCache.store(cDir, dirIV, nametransform.Dir(pRelPath))
return pRelPath, nil
}
diff --git a/internal/fusefrontend_reverse/virtualfile.go b/internal/fusefrontend_reverse/virtualfile.go
index 05b8349..2fae175 100644
--- a/internal/fusefrontend_reverse/virtualfile.go
+++ b/internal/fusefrontend_reverse/virtualfile.go
@@ -7,6 +7,7 @@ import (
"github.com/hanwen/go-fuse/fuse"
"github.com/hanwen/go-fuse/fuse/nodefs"
+ "github.com/rfjakob/gocryptfs/internal/nametransform"
"github.com/rfjakob/gocryptfs/internal/pathiv"
"github.com/rfjakob/gocryptfs/internal/tlog"
)
@@ -31,7 +32,7 @@ const (
)
func (rfs *ReverseFS) newDirIVFile(cRelPath string) (nodefs.File, fuse.Status) {
- cDir := saneDir(cRelPath)
+ cDir := nametransform.Dir(cRelPath)
absDir, err := rfs.abs(rfs.decryptPath(cDir))
if err != nil {
return nil, fuse.ToStatus(err)