Use %q
instead of "%s"
This commit is contained in:
parent
5e5cb056c5
commit
b04550e2f2
8 changed files with 8 additions and 8 deletions
|
@ -107,7 +107,7 @@ type Subscription struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s Subscription) String() string {
|
func (s Subscription) String() string {
|
||||||
return fmt.Sprintf(`Title="%s", URL="%s", Type="%s"`, s.Title, s.URL, s.Type)
|
return fmt.Sprintf(`Title=%q, URL=%q, Type=%q`, s.Title, s.URL, s.Type)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Subscriptions represents a list of subscriptions.
|
// Subscriptions represents a list of subscriptions.
|
||||||
|
|
|
@ -28,7 +28,7 @@ func PushEntries(feed *model.Feed, entries model.Entries, matrixBaseURL, matrixU
|
||||||
|
|
||||||
for _, entry := range entries {
|
for _, entry := range entries {
|
||||||
textMessages = append(textMessages, fmt.Sprintf(`[%s] %s - %s`, feed.Title, entry.Title, entry.URL))
|
textMessages = append(textMessages, fmt.Sprintf(`[%s] %s - %s`, feed.Title, entry.Title, entry.URL))
|
||||||
formattedTextMessages = append(formattedTextMessages, fmt.Sprintf(`<li><strong>%s</strong>: <a href="%s">%s</a></li>`, feed.Title, entry.URL, entry.Title))
|
formattedTextMessages = append(formattedTextMessages, fmt.Sprintf(`<li><strong>%s</strong>: <a href=%q>%s</a></li>`, feed.Title, entry.URL, entry.Title))
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = client.SendFormattedTextMessage(
|
_, err = client.SendFormattedTextMessage(
|
||||||
|
|
|
@ -67,5 +67,5 @@ type Session struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Session) String() string {
|
func (s *Session) String() string {
|
||||||
return fmt.Sprintf(`ID="%s", Data={%v}`, s.ID, s.Data)
|
return fmt.Sprintf(`ID=%q, Data={%v}`, s.ID, s.Data)
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ type UserSession struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (u *UserSession) String() string {
|
func (u *UserSession) String() string {
|
||||||
return fmt.Sprintf(`ID="%d", UserID="%d", IP="%s", Token="%s"`, u.ID, u.UserID, u.IP, u.Token)
|
return fmt.Sprintf(`ID=%q, UserID=%q, IP=%q, Token=%q`, u.ID, u.UserID, u.IP, u.Token)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UseTimezone converts creation date to the given timezone.
|
// UseTimezone converts creation date to the given timezone.
|
||||||
|
|
|
@ -292,7 +292,7 @@ func addInvidiousVideo(entryURL, entryContent string) string {
|
||||||
|
|
||||||
func addPDFLink(entryURL, entryContent string) string {
|
func addPDFLink(entryURL, entryContent string) string {
|
||||||
if strings.HasSuffix(entryURL, ".pdf") {
|
if strings.HasSuffix(entryURL, ".pdf") {
|
||||||
return fmt.Sprintf(`<a href="%s">PDF</a><br>%s`, entryURL, entryContent)
|
return fmt.Sprintf(`<a href=%q>PDF</a><br>%s`, entryURL, entryContent)
|
||||||
}
|
}
|
||||||
return entryContent
|
return entryContent
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,7 +154,7 @@ func sanitizeAttributes(baseURL, tagName string, attributes []html.Attribute) ([
|
||||||
}
|
}
|
||||||
|
|
||||||
attrNames = append(attrNames, attribute.Key)
|
attrNames = append(attrNames, attribute.Key)
|
||||||
htmlAttrs = append(htmlAttrs, fmt.Sprintf(`%s="%s"`, attribute.Key, html.EscapeString(value)))
|
htmlAttrs = append(htmlAttrs, fmt.Sprintf(`%s=%q`, attribute.Key, html.EscapeString(value)))
|
||||||
}
|
}
|
||||||
|
|
||||||
if !isAnchorLink {
|
if !isAnchorLink {
|
||||||
|
|
|
@ -17,7 +17,7 @@ func NewSubscription(title, url, kind string) *Subscription {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s Subscription) String() string {
|
func (s Subscription) String() string {
|
||||||
return fmt.Sprintf(`Title="%s", URL="%s", Type="%s"`, s.Title, s.URL, s.Type)
|
return fmt.Sprintf(`Title=%q, URL=%q, Type=%q`, s.Title, s.URL, s.Type)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Subscriptions represents a list of subscription.
|
// Subscriptions represents a list of subscription.
|
||||||
|
|
|
@ -27,7 +27,7 @@ func (h *handler) showJavascript(w http.ResponseWriter, r *http.Request) {
|
||||||
contents := static.JavascriptBundles[filename]
|
contents := static.JavascriptBundles[filename]
|
||||||
|
|
||||||
if filename == "service-worker" {
|
if filename == "service-worker" {
|
||||||
variables := fmt.Sprintf(`const OFFLINE_URL="%s";`, route.Path(h.router, "offline"))
|
variables := fmt.Sprintf(`const OFFLINE_URL=%q;`, route.Path(h.router, "offline"))
|
||||||
contents = append([]byte(variables)[:], contents[:]...)
|
contents = append([]byte(variables)[:], contents[:]...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue