all: Fix check for empty string (#8456)
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
parent
a2c5d901f2
commit
80ec4acb53
@@ -547,7 +547,7 @@ func slashify(s string) string {
|
||||
// deslashify removes slashes and encrypted file extensions from the string.
|
||||
// This is the inverse of slashify().
|
||||
func deslashify(s string) (string, error) {
|
||||
if len(s) == 0 || !strings.HasPrefix(s[1:], encryptedDirExtension) {
|
||||
if s == "" || !strings.HasPrefix(s[1:], encryptedDirExtension) {
|
||||
return "", fmt.Errorf("invalid encrypted path: %q", s)
|
||||
}
|
||||
s = s[:1] + s[1+len(encryptedDirExtension):]
|
||||
@@ -575,7 +575,7 @@ func IsEncryptedParent(pathComponents []string) bool {
|
||||
} else if l == 0 {
|
||||
return false
|
||||
}
|
||||
if len(pathComponents[0]) == 0 {
|
||||
if pathComponents[0] == "" {
|
||||
return false
|
||||
}
|
||||
if pathComponents[0][1:] != encryptedDirExtension {
|
||||
|
||||
Reference in New Issue
Block a user