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
Alerting: Fix incorrect decoding for alert rules with % characters #76148
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
8033806
fixes incorrect decoding for alert rules with % characters
gillesdemey b0aae07
Patch history package to stop decoding path
konrad147 b7db9b1
Rename rule id extraction function, update tests
konrad147 9bd9c39
Fix patch file
konrad147 30fa901
Merge branch 'main' of github.com:grafana/grafana into alerting/fix-d…
konrad147 8f5af9d
Fix conflicts
soniaAguilarPeiron 2b9124d
Fix copyFrom parameter encoding
konrad147 379e99d
Fix conflict commit
soniaAguilarPeiron f51b16c
Fix test
soniaAguilarPeiron File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
diff --git a/cjs/history.js b/cjs/history.js | ||
index fcd8ebab613c6d87b9ac824feb30ab1080cf0ef2..4df20d5cb2f9ba5fc8777899aada53f49399560b 100644 | ||
--- a/cjs/history.js | ||
+++ b/cjs/history.js | ||
@@ -103,16 +103,6 @@ function createLocation(path, state, key, currentLocation) { | ||
if (state !== undefined && location.state === undefined) location.state = state; | ||
} | ||
|
||
- try { | ||
- location.pathname = decodeURI(location.pathname); | ||
- } catch (e) { | ||
- if (e instanceof URIError) { | ||
- throw new URIError('Pathname "' + location.pathname + '" could not be decoded. ' + 'This is likely caused by an invalid percent-encoding.'); | ||
- } else { | ||
- throw e; | ||
- } | ||
- } | ||
- | ||
if (key) location.key = key; | ||
|
||
if (currentLocation) { | ||
diff --git a/esm/history.js b/esm/history.js | ||
index df67820fe3eed558c44fca07a82b0cd409d46720..e0e0d4f69a407e8de782b3fdf8297d42708e110a 100644 | ||
--- a/esm/history.js | ||
+++ b/esm/history.js | ||
@@ -80,16 +80,6 @@ function createLocation(path, state, key, currentLocation) { | ||
if (state !== undefined && location.state === undefined) location.state = state; | ||
} | ||
|
||
- try { | ||
- location.pathname = decodeURI(location.pathname); | ||
- } catch (e) { | ||
- if (e instanceof URIError) { | ||
- throw new URIError('Pathname "' + location.pathname + '" could not be decoded. ' + 'This is likely caused by an invalid percent-encoding.'); | ||
- } else { | ||
- throw e; | ||
- } | ||
- } | ||
- | ||
if (key) location.key = key; | ||
|
||
if (currentLocation) { | ||
diff --git a/umd/history.js b/umd/history.js | ||
index 80e4ff66c44a2a71d4f842cc05a252e48dd18e9a..f8f4901be95e48c66f5626fbf051747a2ffbe41d 100644 | ||
--- a/umd/history.js | ||
+++ b/umd/history.js | ||
@@ -207,16 +207,6 @@ | ||
if (state !== undefined && location.state === undefined) location.state = state; | ||
} | ||
|
||
- try { | ||
- location.pathname = decodeURI(location.pathname); | ||
- } catch (e) { | ||
- if (e instanceof URIError) { | ||
- throw new URIError('Pathname "' + location.pathname + '" could not be decoded. ' + 'This is likely caused by an invalid percent-encoding.'); | ||
- } else { | ||
- throw e; | ||
- } | ||
- } | ||
- | ||
if (key) location.key = key; | ||
|
||
if (currentLocation) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
{ | ||
"npmClient": "yarn", | ||
"useWorkspaces": true, | ||
"packages": [ | ||
"packages/*" | ||
], | ||
"packages": ["packages/*"], | ||
"version": "10.3.0-pre" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that we're patching the router, do we still need this workaround? Can we go back to using
useParams()
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to verify. IIRC
react-router-dom
has the same bug. In this PR we only patch thehistory
package so it doesn't break outgoing links, but it shouldn't affect parsing path paramsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that react-router added a fix in here , and this fix was included in the v6.4.3 release