-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTMLRenderer crashes when special characters appear in digests #35
Comments
Issue-Label Bot is automatically applying the label Links: app homepage, dashboard and code for this bot. |
Hi @herrsimon ! Thank you for 🐞 report and I'm sorry to hear that it did not work for you and for a delay. Meanwhile, could you please check if the same happens with |
I've seen the same issue caused by LaTeX math expressions in an abstract/title (e.g. I was able to fix it with: --- a/templates/templates.go
+++ b/templates/templates.go
@@ -6,6 +6,7 @@ import (
"bytes"
"encoding/json"
"fmt"
+ "strings"
"html/template"
"io"
"log"
@@ -267,7 +268,8 @@ func (r *HTMLRenderer) Render(out io.Writer, st *papers.Stats, unread, read pape
// rootLayout requires 3 sub-templates
title := `{{ define "title" }}scholar alert digest{{ end }}`
style := fmt.Sprintf(`{{ define "style" }}%s{{ end }}`, r.style)
- body := fmt.Sprintf(`{{ define "body" }}%s{{ end }}`, htmlBuf.String())
+ body_str := strings.Replace(strings.Replace(htmlBuf.String(), "{{", "{ {", -1), "}}", "} }", -1)
+ body := fmt.Sprintf(`{{ define "body" }}%s{{ end }}`, body_str) |
Hello,
I just tried to generate a report out of a large number (~5000) of emails and scholar-alert-digest crashed with the following backtrace:
Unfortunately I don't know which email actually caused this but it looks like some sort of escaping problem before passing things to the go templating engine.
Command was
go run main.go -l scholaralert -authors -html -refs
on the current master branchThe text was updated successfully, but these errors were encountered: