diff options
Diffstat (limited to 'internal/nametransform')
-rw-r--r-- | internal/nametransform/names.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/internal/nametransform/names.go b/internal/nametransform/names.go index e9f9346..675ed34 100644 --- a/internal/nametransform/names.go +++ b/internal/nametransform/names.go @@ -61,7 +61,14 @@ func (n *NameTransform) DecryptName(cipherName string, iv []byte) (string, error for _, pattern := range n.BadnamePatterns { match, err := filepath.Match(pattern, cipherName) if err == nil && match { // Pattern should have been validated already - return "GOCRYPTFS_BAD_NAME " + cipherName, nil + //find longest decryptable substring + for charpos := len(cipherName) - 1; charpos > 0; charpos-- { + res, err = n.decryptName(cipherName[:charpos], iv) + if err == nil { + return res + cipherName[charpos:] + " GOCRYPTFS_BAD_NAME", nil + } + } + return cipherName + " GOCRYPTFS_BAD_NAME", nil } } } |