Fix conflicting messages

This commit is contained in:
Eliot Whalan 2016-06-19 12:10:38 +10:00
parent 103ba4d6a2
commit ab4bc10eaa
1 changed files with 5 additions and 5 deletions

10
main.go
View File

@ -70,13 +70,13 @@ func pasteHandler(w http.ResponseWriter, r *http.Request) {
var s string
err = db.QueryRow("select data from pastebin where id=?", param1).Scan(&s)
db.Close()
if err == sql.ErrNoRows {
io.WriteString(w, "Error invalid paste")
} else {
check(err)
}
check(err)
if param1 != "" {
if err == sql.ErrNoRows {
io.WriteString(w, "Error invalid paste")
}
if param2 != "" {
highlight := pygments.Highlight(html.UnescapeString(s), param2, "html", "full, style=autumn,linenos=True, lineanchors=True,anchorlinenos=True,", "utf-8")
io.WriteString(w, highlight)