Skip to content

Commit 4da4d83

Browse files
committed
fix(gateway): honor trimmed Sentry status values
Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
1 parent f0e781a commit 4da4d83

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

  • rsworkspace/crates/trogon-gateway/src

rsworkspace/crates/trogon-gateway/src/config.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1111,7 +1111,7 @@ fn resolve_sentry(
11111111
) -> Option<trogon_source_sentry::SentryConfig> {
11121112
let explicitly_enabled = matches!(
11131113
section.status.as_deref(),
1114-
Some(status) if status.eq_ignore_ascii_case("enabled")
1114+
Some(status) if status.trim().eq_ignore_ascii_case("enabled")
11151115
);
11161116

11171117
if !resolve_source_status("sentry", section.status.as_deref(), errors) {
@@ -1624,6 +1624,19 @@ status = "enabled"
16241624
);
16251625
}
16261626

1627+
#[test]
1628+
fn sentry_enabled_with_surrounding_whitespace_without_client_secret_is_invalid() {
1629+
let toml = r#"
1630+
[sources.sentry]
1631+
status = " enabled "
1632+
"#;
1633+
let f = write_toml(toml);
1634+
let result = load(Some(f.path()));
1635+
assert!(
1636+
matches!(result, Err(ConfigError::Validation(ref errs)) if errs.iter().any(|e| e.contains("sentry: missing client_secret")))
1637+
);
1638+
}
1639+
16271640
#[test]
16281641
fn notion_missing_token_returns_none() {
16291642
let toml = r#"

0 commit comments

Comments
 (0)