From 6b59c00eb2803eda22261a3347b080244874945f Mon Sep 17 00:00:00 2001 From: JP Appel Date: Thu, 12 Jun 2025 02:15:59 -0400 Subject: Change doc parsing to only read YAML header Fixes unintended YAML decode errors when a documents has a valid header but the rest of its contents are not valid YAML. --- pkg/index/index_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'pkg/index/index_test.go') diff --git a/pkg/index/index_test.go b/pkg/index/index_test.go index 4bf49e3..4e55325 100644 --- a/pkg/index/index_test.go +++ b/pkg/index/index_test.go @@ -193,7 +193,7 @@ func TestIndex_ParseOne(t *testing.T) { f, path := newTestFile(t, "date") defer f.Close() - f.WriteString("---\ndate: May 1, 2025") + f.WriteString("---\ndate: May 1, 2025\n---\n") return path }, @@ -266,6 +266,7 @@ func TestIndex_ParseOne(t *testing.T) { if !errors.Is(gotErr, tt.wantErr) { t.Errorf("Recieved unexpected error: want %v got %v", tt.wantErr, gotErr) + return } else if gotErr != nil { return } -- cgit v1.2.3