Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent the pattern matching for KV V2 operations if a trailing slash… #64

Merged
merged 4 commits into from Sep 28, 2022
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion path_data.go
Expand Up @@ -18,11 +18,15 @@ import (
"github.com/mitchellh/mapstructure"
)

func matchAllNoTrailingSlashRegex(name string) string {
return fmt.Sprintf(`(?P<%s>.*?[^/])`, name)
peteski22 marked this conversation as resolved.
Show resolved Hide resolved
}

// pathConfig returns the path configuration for CRUD operations on the backend
// configuration.
func pathData(b *versionedKVBackend) *framework.Path {
return &framework.Path{
Pattern: "data/" + framework.MatchAllRegex("path"),
Pattern: "data/" + matchAllNoTrailingSlashRegex("path"),
Fields: map[string]*framework.FieldSchema{
"path": {
Type: framework.TypeString,
Expand Down