Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rule: Fix URI encoding of strings #7009

Merged
merged 1 commit into from
Dec 27, 2023

Conversation

kartikaysaxena
Copy link
Contributor

@kartikaysaxena kartikaysaxena commented Dec 26, 2023

  • I added CHANGELOG entry for this change.
  • Change is not relevant to the end user.

Changes

Should fix #7002
Added how the URI should treat + as it is ignored by url.QueryEscape

Reference

@kartikaysaxena kartikaysaxena changed the title Fix URI encoding of strings Rule: Fix URI encoding of strings Dec 26, 2023
Copy link
Contributor

@MichaHoffmann MichaHoffmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a test in Test_tableLinkForExpression please? but to be honest: i dont understand it; the URL seems valid on its own ( not in a html context ); is this maybe an issue of whatever renders the notification in the end?

@MichaHoffmann
Copy link
Contributor

Ah i understand now; spaces are encoded as + by the stdlib (golang/go#4013) and the html/template package then escapes that again to &#43. I wonder wouldnt it be easier to not render the URL as html but just use "text/template"? That way we are sure we are not replacing anything else too. ( POC playground: https://go.dev/play/p/Jpl3iCbtQLR )

cmd/thanos/rule.go Outdated Show resolved Hide resolved
Copy link
Contributor

@MichaHoffmann MichaHoffmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, can you squash commits please?

yeya24
yeya24 previously approved these changes Dec 27, 2023
Copy link
Contributor

@yeya24 yeya24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Can we update changelog?

Copy link
Contributor

@MichaHoffmann MichaHoffmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@MichaHoffmann MichaHoffmann merged commit ee9288f into thanos-io:main Dec 27, 2023
20 checks passed
@kartikaysaxena kartikaysaxena deleted the url_template branch April 29, 2024 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rule: upgrade to v0.33.0: error in thanos url template
3 participants