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

Remove duplicate decodeURIComponent call in segmentcontroller #14952

Merged
merged 2 commits into from Oct 7, 2019
Merged

Conversation

katebutler
Copy link

Fixes #14943
This line is not needed as the decodeURIComponent is already done whenever newmetric.value is set.

@katebutler katebutler added the Needs Review PRs that need a code review label Oct 3, 2019
@katebutler katebutler added this to the 3.12.0 milestone Oct 3, 2019
@tsteur
Copy link
Member

tsteur commented Oct 4, 2019

@katebutler it seems to work for my case but now failing for this case: https://builds-artifacts.matomo.org/matomo-org/matomo/3.x-dev/36240/SegmentSelectorEditorTest_saved_details.png

I wonder if that's because some segments might be double encoded while some might not or so...

I reckon we could just try to decode it there, and if it fails return the regular version... like

try {
return decode...(newMetric.value)
} catch (e){
return newMetric.value
}

@katebutler
Copy link
Author

@tsteur Have added a second decodeUIRComponent in a try/catch as suggested, build passes now.

@tsteur tsteur merged commit 1623e04 into 3.x-dev Oct 7, 2019
@tsteur tsteur deleted the 14943 branch October 7, 2019 01:10
@mattab mattab added the not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. label Oct 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Segment editor may fail with URIError: URI malformed
3 participants