]> Sergey Matveev's repositories - sgblog.git/blobdiff - cmd/sgblog/http.go
Proper URL path escaping
[sgblog.git] / cmd / sgblog / http.go
index 4712a50f13584b98a81542a1d71cdd69c44307df..808c3d99fd687b8c025114ea6ecb80c030bd2fc4 100644 (file)
@@ -142,7 +142,7 @@ Topics: {{range .Topics}}[<tt><a href="{{$Cfg.URLPrefix}}?topic={{.}}">{{.}}</a>
 {{end}}</pre>
 <hr/>{{end}}
 
-{{if .Cfg.CommentsEmail}}[<a href="mailto:{{.Cfg.CommentsEmail}}?subject=Re:%20{{.TitleEscaped}}%20({{.Commit.Hash.String}})">leave comment</a>]{{end}}
+{{if .Cfg.CommentsEmail}}[<a href="mailto:{{.Cfg.CommentsEmail}}?subject={{.TitleEscaped}}">leave comment</a>]{{end}}
 
 <dl>{{range $idx, $comment := .Comments}}
 <dt><a name="comment{{$idx}}"><a href="#comment{{$idx}}">comment {{$idx}}</a>:</dt>
@@ -798,7 +798,7 @@ func serveHTTP() {
                        Version:         sgblog.Version,
                        Cfg:             cfg,
                        Title:           title,
-                       TitleEscaped:    strings.ReplaceAll(title, " ", "%20"),
+                       TitleEscaped:    url.PathEscape(fmt.Sprintf("Re: %s (%s)", title, commit.Hash)),
                        When:            when,
                        AtomCommentsURL: atomCommentsURL,
                        Parent:          parent,