From 50b0c0a520e52d6970ac348da3a052f9c7f3b664 Mon Sep 17 00:00:00 2001 From: Mikhail Klementyev Date: Tue, 26 Jul 2016 00:04:32 +0300 Subject: [PATCH] Fix replace url with id --- commands/commands.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/commands/commands.go b/commands/commands.go index b2a79ad..6d26031 100644 --- a/commands/commands.go +++ b/commands/commands.go @@ -38,8 +38,10 @@ func parseLink(db *sql.DB, oldPage, value string, req *http.Request) (htmlPage s } } + htmlPage = oldPage + for _, s := range []string{value, html.EscapeString(value)} { - htmlPage = strings.Replace(oldPage, "\""+s+"\"", + htmlPage = strings.Replace(htmlPage, "\""+s+"\"", "\""+fmt.Sprintf("%d", linkNo)+"\"", -1) }