From b0dadddfc21a530a45f969ddb0d2d92378d97a41 Mon Sep 17 00:00:00 2001 From: Adam Kapos Date: Fri, 2 Oct 2026 15:46:23 +0300 Subject: [PATCH 1/2] fix: Ignore trailing slashes in URL conflict warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Auth tokens with embedded URLs (e.g. sntrys_ org tokens) store the instance URL without a trailing slash (https://sentry.io), while manually-configured URLs commonly include one (https://sentry.io/) — notably the default SENTRY_URL injected by @sentry/expo-upload-sourcemaps. The literal string comparison flagged these as conflicting and warned even though both URLs are the same server. Compare URLs with trailing slashes trimmed so only genuine conflicts warn. _Written by AI_ Co-authored-by: Cursor --- src/config.rs | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/src/config.rs b/src/config.rs index a12b6cf57b..7e96ca3b7a 100644 --- a/src/config.rs +++ b/src/config.rs @@ -771,7 +771,7 @@ fn merge_config_source(base: &mut Ini, overlay: &Ini) -> Option) { if let Some(manually_configured_url) = manually_configured_url { - if manually_configured_url != token_url { + if !urls_equivalent(token_url, manually_configured_url) { warn!( "Using {token_url} (embedded in token) rather than manually-configured URL \ {manually_configured_url}. To use {manually_configured_url}, please provide an \ @@ -781,6 +781,12 @@ fn warn_about_conflicting_urls(token_url: &str, manually_configured_url: Option< } } +/// Returns whether two URLs refer to the same Sentry instance, ignoring +/// trailing slashes (`https://sentry.io` and `https://sentry.io/` are equal). +fn urls_equivalent(a: &str, b: &str) -> bool { + a.trim_end_matches('/') == b.trim_end_matches('/') +} + fn find_global_config_file() -> Result { let home_dir_file = dirs::home_dir().map(|p| p.join(CONFIG_RC_FILE_NAME)); let config_dir_file = dirs::config_dir().map(|p| p.join(CONFIG_INI_FILE_PATH)); @@ -1085,4 +1091,28 @@ mod tests { "https://us.sentry.io/api/0/organizations/test-org/chunk-upload/" ); } + + #[test] + fn urls_equivalent_ignores_trailing_slashes() { + assert!(urls_equivalent("https://sentry.io", "https://sentry.io/")); + assert!(urls_equivalent("https://sentry.io/", "https://sentry.io")); + assert!(urls_equivalent("https://sentry.io", "https://sentry.io")); + assert!(urls_equivalent( + "http://localhost:8000", + "http://localhost:8000/" + )); + } + + #[test] + fn urls_equivalent_detects_different_urls() { + assert!(!urls_equivalent( + "https://sentry.io", + "https://us.sentry.io" + )); + assert!(!urls_equivalent( + "https://sentry.io", + "https://sentry.io.evil.com" + )); + assert!(!urls_equivalent("https://sentry.io", "http://sentry.io/")); + } } From 274b0fe922bce716f00c43fcb66f81bc7ce7fe56 Mon Sep 17 00:00:00 2001 From: Adam Kapos Date: Fri, 2 Oct 2026 15:46:43 +0300 Subject: [PATCH 2/2] meta: Add changelog entry _Written by AI_ Co-authored-by: Cursor --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a9f9c6781..3ec4d288aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased + +### Fixes + +- Ignore trailing slashes when comparing the configured URL with the auth token's embedded URL, removing a spurious conflict warning ([#3420](https://github.com/getsentry/sentry-cli/pull/3420)) + ## 3.8.0 ### Improvements