diff --git a/templates/interactions.gohtml b/templates/interactions.gohtml
index c84d122..0dfc83b 100644
--- a/templates/interactions.gohtml
+++ b/templates/interactions.gohtml
@@ -12,7 +12,7 @@
{{ else }}
{{ $mention.Source }}
{{ end }}
- {{ with $mention.Title }} {{.}}{{ end }}
+ {{ with $mention.Title }} {{.}}{{ end }}{{ with $mention.Content }} {{.}}{{ end }}
{{ end }}
{{ end }}
diff --git a/utils.go b/utils.go
index c323844..b4ba726 100644
--- a/utils.go
+++ b/utils.go
@@ -101,6 +101,14 @@ func resolveURLReferences(base string, refs ...string) ([]string, error) {
return urls, nil
}
+func unescapedPath(p string) string {
+ u, err := url.PathUnescape(p)
+ if err != nil {
+ return p
+ }
+ return u
+}
+
func slashIfEmpty(s string) string {
if s == "" {
return "/"
diff --git a/webmention.go b/webmention.go
index c1e517e..3fd1b33 100644
--- a/webmention.go
+++ b/webmention.go
@@ -128,7 +128,7 @@ func webmentionAdminApprove(w http.ResponseWriter, r *http.Request) {
func webmentionExists(source, target string) bool {
result := 0
- row, err := appDbQueryRow("select exists(select 1 from webmentions where source = ? and target = ?)", source, target)
+ row, err := appDbQueryRow("select exists(select 1 from webmentions where source = ? and target = ?)", source, unescapedPath(target))
if err != nil {
return false
}
@@ -140,9 +140,9 @@ func webmentionExists(source, target string) bool {
func createWebmention(source, target string) (err error) {
if webmentionExists(source, target) {
- _, err = appDbExec("update webmentions set status = ? where source = ? and target = ?", webmentionStatusRenew, source, target)
+ _, err = appDbExec("update webmentions set status = ? where source = ? and target = ?", webmentionStatusRenew, source, unescapedPath(target))
} else {
- _, err = appDbExec("insert into webmentions (source, target, created) values (?, ?, ?)", source, target, time.Now().Unix())
+ _, err = appDbExec("insert into webmentions (source, target, created) values (?, ?, ?)", source, unescapedPath(target), time.Now().Unix())
}
return err
}
@@ -172,7 +172,7 @@ func getWebmentions(config *webmentionsRequestConfig) ([]*mention, error) {
if config != nil {
if config.target != "" && config.status != "" {
filter = "where target = @target and status = @status"
- args = append(args, sql.Named("target", config.target), sql.Named("status", config.status))
+ args = append(args, sql.Named("target", unescapedPath(config.target)), sql.Named("status", config.status))
} else if config.target != "" {
filter = "where target = @target"
args = append(args, sql.Named("target", config.target))
diff --git a/webmentionVerification.go b/webmentionVerification.go
index ad2fefe..cf9bd56 100644
--- a/webmentionVerification.go
+++ b/webmentionVerification.go
@@ -79,7 +79,7 @@ func wmVerifyReader(body io.Reader, m *mention) error {
}
hasLink := false
for _, link := range links {
- if link == m.Target {
+ if unescapedPath(link) == unescapedPath(m.Target) {
hasLink = true
break
}