Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# vNext

* Increase max cached events to 30 (#1029)
* Normalize DSN URI (#1030)

# 3.1.2

Expand Down
2 changes: 1 addition & 1 deletion sentry/src/main/java/io/sentry/Dsn.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ URI getSentryUri() {

Dsn(@Nullable String dsn) throws InvalidDsnException {
try {
URI uri = new URI(dsn);
URI uri = new URI(dsn).normalize();
String userInfo = uri.getUserInfo();
if (userInfo == null || userInfo.isEmpty()) {
throw new IllegalArgumentException("Invalid DSN: No public key provided.");
Expand Down
6 changes: 6 additions & 0 deletions sentry/src/test/java/io/sentry/DsnTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,10 @@ class DsnTest {
val ex = assertFailsWith<InvalidDsnException> { Dsn("https://:secret@host/path/id") }
assertEquals("java.lang.IllegalArgumentException: Invalid DSN: No public key provided.", ex.message)
}

@Test
fun `dsn is normalized`() {
val dsn = Dsn("http://key@host//id")
assertEquals("http://host/api/id", dsn.sentryUri.toURL().toString())
}
}