From 8135e8ada99feadc34f46d79af86cdbcbc949988 Mon Sep 17 00:00:00 2001 From: Tinyblargon <76069640+Tinyblargon@users.noreply.github.com> Date: Mon, 26 Aug 2024 07:57:35 +0200 Subject: [PATCH] fix: missing case `/dev/` --- proxmox/config_qemu_serial.go | 2 +- proxmox/config_qemu_serial_test.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/proxmox/config_qemu_serial.go b/proxmox/config_qemu_serial.go index 1bb1eec3..878a6351 100644 --- a/proxmox/config_qemu_serial.go +++ b/proxmox/config_qemu_serial.go @@ -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" diff --git a/proxmox/config_qemu_serial_test.go b/proxmox/config_qemu_serial_test.go index 698964f3..276a9d74 100644 --- a/proxmox/config_qemu_serial_test.go +++ b/proxmox/config_qemu_serial_test.go @@ -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) {