diff options
Diffstat (limited to 'cryptfs/cryptfs_names.go')
-rw-r--r-- | cryptfs/cryptfs_names.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/cryptfs/cryptfs_names.go b/cryptfs/cryptfs_names.go index c4f2a36..f694fa5 100644 --- a/cryptfs/cryptfs_names.go +++ b/cryptfs/cryptfs_names.go @@ -19,6 +19,12 @@ const ( // DecryptName - decrypt filename func (be *CryptFS) decryptName(cipherName string) (string, error) { + // Make sure relative symlinks still work after encryption + // by passing these trough unchanged + if cipherName == "." || cipherName == ".." { + return cipherName, nil + } + bin, err := base64.URLEncoding.DecodeString(cipherName) if err != nil { return "", err @@ -44,6 +50,12 @@ func (be *CryptFS) decryptName(cipherName string) (string, error) { // EncryptName - encrypt filename func (be *CryptFS) encryptName(plainName string) string { + // Make sure relative symlinks still work after encryption + // by passing these trough unchanged + if plainName == "." || plainName == ".." { + return plainName + } + bin := []byte(plainName) bin = be.pad16(bin) |