]> Sergey Matveev's repositories - sgblog.git/commitdiff
Proper URL path escaping v0.10.1
authorSergey Matveev <stargrave@stargrave.org>
Sat, 31 Oct 2020 13:29:40 +0000 (16:29 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Sat, 31 Oct 2020 13:29:40 +0000 (16:29 +0300)
cmd/sgblog/http.go
common.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,
index 821d5b39deba806acabfaa2f4ee4b09a195fdc6a..b324d87d85f8acbf99abb70e7f3cc2b8fe345221 100644 (file)
--- a/common.go
+++ b/common.go
@@ -2,6 +2,6 @@
 package sgblog
 
 const (
-       Version = "0.10.0"
+       Version = "0.10.1"
        WhenFmt = "2006-01-02 15:04:05Z07:00"
 )