Fix remount tests (#10265)

This commit is contained in:
Vishal Nayak 2020-10-29 14:31:58 -04:00 committed by GitHub
parent 2f369730e0
commit 30fe58a458
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -1018,7 +1018,12 @@ func (b *SystemBackend) handleUnmount(ctx context.Context, req *logical.Request,
}
func validateMountPath(p string) error {
hasSuffix := strings.HasSuffix(p, "/")
s := path.Clean(p)
// Retain the trailing slash if it was provided
if hasSuffix {
s = s + "/"
}
if p != s {
return fmt.Errorf("path '%v' does not match cleaned path '%v'", p, s)
}