all repos — navani @ 57138aa32c9fa1554d3eb783367906b810b98f66

forlater's primary mail processing service

Strip query parameters from URL
Anirudh Oppiliappan x@icyphox.sh
Fri, 17 Sep 2021 18:03:38 +0530
commit

57138aa32c9fa1554d3eb783367906b810b98f66

parent

8836f20495e17361d15b1da6eb7bc4c6f2cd063c

1 files changed, 8 insertions(+), 1 deletions(-)

jump to
M mail/template.gomail/template.go

@@ -3,10 +3,17 @@

import ( "bytes" "html/template" + "net/url" "path/filepath" "git.icyphox.sh/forlater/navani/reader" ) + +func stripQueryParams(u *url.URL) string { + u.RawQuery = "" + u.Fragment = "" + return u.String() +} func RenderTemplate(file string, article *reader.Article) ([]byte, error) { t, err := template.ParseGlob(filepath.Join("templates", "*.tpl"))

@@ -24,7 +31,7 @@ }{

template.HTML(article.Content), article.Title, article.Byline, - article.URL.String(), + stripQueryParams(article.URL), }); err != nil { return nil, err }