Skip to content

Commit

Permalink
fix: missing case /dev/
Browse files Browse the repository at this point in the history
  • Loading branch information
Tinyblargon committed Aug 26, 2024
1 parent 9479ef9 commit 8135e8a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion proxmox/config_qemu_serial.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const (
SerialInterface_Errors_Empty string = "path or socket must be set"
)

var regexSerialPortPath = regexp.MustCompile(`^/dev/.*$`)
var regexSerialPortPath = regexp.MustCompile(`^/dev/.+$`)

func (port SerialInterface) mapToAPI(id SerialID, params map[string]interface{}) {
tmpPath := "socket"
Expand Down
3 changes: 3 additions & 0 deletions proxmox/config_qemu_serial_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ func Test_SerialPath_Validate(t *testing.T) {
{name: `Invalid errors.New(SerialPath_Errors_Invalid)`,
input: "ttyS0",
output: errors.New(SerialPath_Errors_Invalid)},
{name: `Invalid /dev/ only`,
input: "/dev/",
output: errors.New(SerialPath_Errors_Invalid)},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
Expand Down

0 comments on commit 8135e8a

Please sign in to comment.