Skip to content

Commit

Permalink
Address comments
Browse files Browse the repository at this point in the history
Signed-off-by: Kartikay <[email protected]>
  • Loading branch information
kartikaysaxena committed Dec 26, 2023
1 parent e83e033 commit fa17410
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions cmd/thanos/rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"bytes"
"context"
"fmt"
"html/template"
"text/template"
"math/rand"
"net/http"
"net/url"
Expand Down Expand Up @@ -936,10 +936,10 @@ func reloadRules(logger log.Logger,

func tableLinkForExpression(tmpl string, expr string) (string, error) {
// template example: "/graph?g0.expr={{.Expr}}&g0.tab=1"
escapedExpression := strings.ReplaceAll(url.QueryEscape(expr), "+", "%20")
escapedExpression := url.QueryEscape(expr)

escapedExpr := Expression{Expr: escapedExpression}
t, err := template.New("url").Parse(tmpl)
t, err := template.New("name").Parse(tmpl)
if err != nil {
return "", errors.Wrap(err, "failed to parse template")
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/thanos/rule_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func Test_tableLinkForExpression(t *testing.T) {
{
template: `/graph?g0.expr={{.Expr}}&g0.tab=1`,
expr: `up{app="foo yoo"}`,
expectStr: `/graph?g0.expr=up%7Bapp%3D%22foo%20yoo%22%7D&g0.tab=1`,
expectStr: `/graph?g0.expr=up%7Bapp%3D%22foo+yoo%22%7D&g0.tab=1`,
expectErr: false,
},
{
Expand Down

0 comments on commit fa17410

Please sign in to comment.