mirror of
https://github.com/usememos/memos.git
synced 2025-03-04 01:04:38 +08:00
chore: fix html escaping
This commit is contained in:
parent
770607f93f
commit
2c4b5d75b3
3 changed files with 6 additions and 18 deletions
|
@ -3,6 +3,7 @@ package frontend
|
||||||
import (
|
import (
|
||||||
"embed"
|
"embed"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"html/template"
|
||||||
"io/fs"
|
"io/fs"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -172,14 +173,14 @@ func generateMemoMetadata(memo *store.Memo, creator *store.User) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
metadataList := []string{
|
metadataList := []string{
|
||||||
fmt.Sprintf(`<meta name="description" content="%s" />`, description),
|
fmt.Sprintf(`<meta name="description" content="%s" />`, template.HTMLEscapeString(description)),
|
||||||
fmt.Sprintf(`<meta property="og:title" content="%s" />`, fmt.Sprintf("%s(@%s) on Memos", creator.Nickname, creator.Username)),
|
fmt.Sprintf(`<meta property="og:title" content="%s" />`, template.HTMLEscapeString(fmt.Sprintf("%s(@%s) on Memos", creator.Nickname, creator.Username))),
|
||||||
fmt.Sprintf(`<meta property="og:description" content="%s" />`, description),
|
fmt.Sprintf(`<meta property="og:description" content="%s" />`, template.HTMLEscapeString(description)),
|
||||||
fmt.Sprintf(`<meta property="og:image" content="%s" />`, "https://www.usememos.com/logo.png"),
|
fmt.Sprintf(`<meta property="og:image" content="%s" />`, "https://www.usememos.com/logo.png"),
|
||||||
`<meta property="og:type" content="website" />`,
|
`<meta property="og:type" content="website" />`,
|
||||||
// Twitter related metadata.
|
// Twitter related metadata.
|
||||||
fmt.Sprintf(`<meta name="twitter:title" content="%s" />`, fmt.Sprintf("%s(@%s) on Memos", creator.Nickname, creator.Username)),
|
fmt.Sprintf(`<meta name="twitter:title" content="%s" />`, template.HTMLEscapeString(fmt.Sprintf("%s(@%s) on Memos", creator.Nickname, creator.Username))),
|
||||||
fmt.Sprintf(`<meta name="twitter:description" content="%s" />`, description),
|
fmt.Sprintf(`<meta name="twitter:description" content="%s" />`, template.HTMLEscapeString(description)),
|
||||||
fmt.Sprintf(`<meta name="twitter:image" content="%s" />`, "https://www.usememos.com/logo.png"),
|
fmt.Sprintf(`<meta name="twitter:image" content="%s" />`, "https://www.usememos.com/logo.png"),
|
||||||
`<meta name="twitter:card" content="summary" />`,
|
`<meta name="twitter:card" content="summary" />`,
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
package store
|
package store
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
)
|
|
||||||
|
|
||||||
type MigrationHistory struct {
|
type MigrationHistory struct {
|
||||||
Version string
|
Version string
|
||||||
CreatedTs int64
|
CreatedTs int64
|
||||||
|
@ -15,11 +11,3 @@ type UpsertMigrationHistory struct {
|
||||||
|
|
||||||
type FindMigrationHistory struct {
|
type FindMigrationHistory struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Store) FindMigrationHistoryList(ctx context.Context, find *FindMigrationHistory) ([]*MigrationHistory, error) {
|
|
||||||
return s.driver.FindMigrationHistoryList(ctx, find)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *Store) UpsertMigrationHistory(ctx context.Context, upsert *UpsertMigrationHistory) (*MigrationHistory, error) {
|
|
||||||
return s.driver.UpsertMigrationHistory(ctx, upsert)
|
|
||||||
}
|
|
||||||
|
|
|
@ -33,7 +33,6 @@ func GetTestingProfile(t *testing.T) *profile.Profile {
|
||||||
if driver == "sqlite" {
|
if driver == "sqlite" {
|
||||||
dsn = fmt.Sprintf("%s/memos_%s.db", dir, mode)
|
dsn = fmt.Sprintf("%s/memos_%s.db", dir, mode)
|
||||||
}
|
}
|
||||||
println("dsn", dsn, driver)
|
|
||||||
return &profile.Profile{
|
return &profile.Profile{
|
||||||
Mode: mode,
|
Mode: mode,
|
||||||
Port: port,
|
Port: port,
|
||||||
|
|
Loading…
Reference in a new issue