Skip to content

Commit 76b23db

Browse files
Merge pull request #507 from AtjonTV/506-improve-dsn-parsing
Improve DSN parsing and Endpoint building
2 parents 27f14cf + 517482b commit 76b23db

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/sentry/client.ex

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,11 @@ defmodule Sentry.Client do
257257
%URI{userinfo: userinfo, host: host, port: port, path: path, scheme: protocol}
258258
when is_binary(path) and is_binary(userinfo) <- URI.parse(dsn),
259259
[public_key, secret_key] <- keys_from_userinfo(userinfo),
260-
[_, binary_project_id] <- String.split(path, "/"),
260+
uri_path <- String.split(path, "/"),
261+
{binary_project_id, uri_path} <- List.pop_at(uri_path, -1),
262+
base_path <- Enum.join(uri_path, "/"),
261263
{project_id, ""} <- Integer.parse(binary_project_id),
262-
endpoint <- "#{protocol}://#{host}:#{port}/api/#{project_id}/envelope/" do
264+
endpoint <- "#{protocol}://#{host}:#{port}#{base_path}/api/#{project_id}/envelope/" do
263265
{endpoint, public_key, secret_key}
264266
else
265267
_ ->

0 commit comments

Comments
 (0)