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

Ignore broken regex for tracePropagationTarget #2288

Merged
merged 16 commits into from Oct 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 5 additions & 4 deletions CHANGELOG.md
Expand Up @@ -2,14 +2,15 @@

## Unreleased

### Features

- Add captureProfile method to hub and client ([#2290](https://github.com/getsentry/sentry-java/pull/2290))

### Fixes

- Ensure potential callback exceptions are caught #2123 ([#2291](https://github.com/getsentry/sentry-java/pull/2291))
- Remove verbose FrameMetricsAggregator failure logging ([#2293](https://github.com/getsentry/sentry-java/pull/2293))
- Ignore broken regex for tracePropagationTarget ([#2288](https://github.com/getsentry/sentry-java/pull/2288))

### Features

- Add captureProfile method to hub and client ([#2290](https://github.com/getsentry/sentry-java/pull/2290))

## 6.5.0

Expand Down
Expand Up @@ -15,9 +15,16 @@ public static boolean contain(final @NotNull List<String> origins, final @NotNul
return false;
}
for (final String origin : origins) {
if (url.contains(origin) || url.matches(origin)) {
if (url.contains(origin)) {
return true;
}
try {
if (url.matches(origin)) {
return true;
}
Comment on lines +22 to +24
Copy link
Member

@romtsn romtsn Oct 13, 2022

Choose a reason for hiding this comment

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

Suggested change
if (url.matches(origin)) {
return true;
}
return url.matches(origin);

could be just this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oops, no we can't because then we'd just return whether the first entry in the list matches but we want to check all of them and only return false if none of them match.

} catch (Exception e) {
// ignore invalid regex
}
}
return false;
}
Expand Down
Expand Up @@ -26,4 +26,9 @@ class TracePropagationTargetsTest {
fun `when no origins are defined, returns false for every url`() {
assertFalse(TracePropagationTargets.contain(emptyList(), "http://some.api.com/"))
}

@Test
fun `ignores broken regex`() {
assertFalse(TracePropagationTargets.contain(listOf("AABB???"), "http://some.api.com/"))
}
}