-
Notifications
You must be signed in to change notification settings - Fork 479
Commit 04a3285


May Hartov
May Hartov
Merged PR 539275: removed global flag from valid embed hosts validation
removed global flag from valid embed hosts validation to resolve bug introduced with 2.23.0 release:
Issue reported [here](https://community.fabric.microsoft.com/t5/Developer/bd-p/Developer) and by @<Sergey Pustynsky> from datahub (attaching Sergey's description):
We started to get
"Invalid embed URL detected. Either URL hostname or protocol are invalid. Please use Power BI REST APIs to get the valid URL";
in Datahub embed scenario. We have 2 tabs, each one renders iframe with different configs. Once it rendered OK, 2nd time fails on error.
It caused by this code, which looks valid
The result of this check is inconsistent (once returns true, once false) over the same data. It's possibly related to RegEx statefullness.
Do we really need this global flag in RegEx definition?
Symptoms:
`When a RegExp object is created with the global (g) or sticky (y) flag, it maintains an internal lastIndex property. This property is used to determine where to start the next match attempt during subsequent calls to .test() or .exec() methods. After each match attempt, lastIndex is updated. This means if a match is found, the next call to .test() will start searching from the position after the last match, which can lead to the following outcomes:
If the next call does not find a match (because it starts searching from a non-zero lastIndex), .test() will return false.
If you call .test() again after it returns false, lastIndex is reset to 0, and the regex is evaluated from the beginning of the string, potentially returning true again if a match is found from the start.`
Related work items: #13622471 parent 85fe031 commit 04a3285Copy full SHA for 04a3285
File tree
Expand file treeCollapse file tree
3 files changed
+19
-190
lines changedFilter options
- dist
- src
Expand file treeCollapse file tree
3 files changed
+19
-190
lines changed
0 commit comments