1
0
mirror of https://github.com/amir20/dozzle.git synced 2025-12-30 17:47:28 +01:00

fix: fixes log parser (#3398)

This commit is contained in:
Vladimir Urushev
2024-11-16 17:24:40 +01:00
committed by GitHub
parent 56a2ab11a9
commit 80d502eb29
2 changed files with 7 additions and 1 deletions

View File

@@ -17,7 +17,7 @@ func ParseLogFmt(log string) (*orderedmap.OrderedMap[string, string], error) {
char := log[i]
if isKey {
if char == '=' {
if i == start {
if start >= i {
return nil, errors.New("invalid format: key is empty")
}
key = log[start:i]

View File

@@ -67,6 +67,12 @@ func TestParseLog(t *testing.T) {
),
wantErr: false,
},
{
name: "Broken format with unexpected quotes",
log: `key1=value"1"= key2="value2"`,
want: nil,
wantErr: true,
},
{
name: "Invalid log with unclosed quotes",
log: "key1=\"value1 key2=value2",