Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/util/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (

// A regex to verify the expected format: 0000-0000-arbitrary-number-of-000-and-chars.
// First two blocks are hexadecimal.
var validator = regexp.MustCompile(`^[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[a-zA-Z0-9\-]+$`)
var validator = regexp.MustCompile(`^[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[a-zA-Z0-9\-_]+$`)

// ValidateControllerPublishVolumeRequest validates the controller publish request.
func ValidateControllerPublishVolumeRequest(req *csi.ControllerPublishVolumeRequest) error {
Expand Down
1 change: 1 addition & 0 deletions internal/util/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func TestValidateVolumeID(t *testing.T) {
{"valid short", "0001-0024-pool-abc", false, false},
{"valid long", "0001-0024-cluster-pool-0000-0000-0000-0001", false, false},
{"valid very long", "0001-000b-clusterID-1-0000000000000001-c156bd07-e430-435f-b175-56c61a2d9297", false, false},
{"valid with underscore", "0001-0024-rook_ceph-pool-uuid", false, false},
{"invalid very long", "00fg-01bg-clusterID-1-0000000000000001-c156bd07-e430-435f-b175-56c61a2d9297", false, true},

// Static Volumes, skip enforcing format.
Expand Down