From ac90cb2c80e87d5b6cc9fa5e30e15b1cfd2d42dd Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Wed, 2 Sep 2020 09:33:16 -0400 Subject: [PATCH 1/2] Fix panic in TestViewOauthCallback --- oauth_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oauth_test.go b/oauth_test.go index 96f65b2..f454f1a 100644 --- a/oauth_test.go +++ b/oauth_test.go @@ -244,7 +244,7 @@ func TestViewOauthCallback(t *testing.T) { req, err := http.NewRequest("GET", "/oauth/callback", nil) assert.NoError(t, err) rr := httptest.NewRecorder() - err = h.viewOauthCallback(nil, rr, req) + err = h.viewOauthCallback(&App{cfg: app.Config(), sessionStore: app.SessionStore()}, rr, req) assert.NoError(t, err) assert.Equal(t, http.StatusTemporaryRedirect, rr.Code) }) From 98d88b9a4b911a3ed281924c8316a5508f3e272f Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Wed, 2 Sep 2020 09:38:02 -0400 Subject: [PATCH 2/2] Truncate lede at question mark This fixes TestPostLede and closes #316. --- parse/posts.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/parse/posts.go b/parse/posts.go index 6cd5217..f660e08 100644 --- a/parse/posts.go +++ b/parse/posts.go @@ -1,5 +1,5 @@ /* - * Copyright © 2018 A Bunch Tell LLC. + * Copyright © 2018-2020 A Bunch Tell LLC. * * This file is part of WriteFreely. * @@ -57,6 +57,11 @@ func PostLede(t string, includePunc bool) string { c := []rune(t) t = string(c[:punc+iAdj]) } + punc = stringmanip.IndexRune(t, '?') + if punc > -1 { + c := []rune(t) + t = string(c[:punc+iAdj]) + } return t }