Skip to content

Commit 1db26af

Browse files
committed
modified route params
1 parent a0b8488 commit 1db26af

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

sentry/src/lib.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ lazy_static! {
6565
static ref PUBLISHER_ANALYTICS_BY_CHANNEL_ID: Regex = Regex::new(r"^/analytics/for-publisher/0x([a-zA-Z0-9]{64})/?$").expect("The regex should be valid");
6666
static ref CREATE_EVENTS_BY_CHANNEL_ID: Regex = Regex::new(r"^/channel/0x([a-zA-Z0-9]{64})/events/?$").expect("The regex should be valid");
6767
static ref CHANNEL_SPENDER_LEAF_AND_TOTAL_DEPOSITED: Regex = Regex::new(r"^/v5/channel/0x([a-zA-Z0-9]{64})/spender/0x([a-zA-Z0-9]{40})/?$").expect("This regex should be valid");
68-
static ref CHANNEL_ALL_SPENDER_LIMITS: Regex = Regex::new(r"^/v5/channel/0x([a-zA-Z0-9]{64})/spender/all/?$").expect("This regex should be valid");
6968
}
7069

7170
static INSERT_EVENTS_BY_CAMPAIGN_ID: Lazy<Regex> = Lazy::new(|| {
@@ -77,6 +76,9 @@ static CLOSE_CAMPAIGN_BY_CAMPAIGN_ID: Lazy<Regex> = Lazy::new(|| {
7776
static CAMPAIGN_UPDATE_BY_ID: Lazy<Regex> = Lazy::new(|| {
7877
Regex::new(r"^/v5/campaign/0x([a-zA-Z0-9]{32})/?$").expect("The regex should be valid")
7978
});
79+
static CHANNEL_ALL_SPENDER_LIMITS: Lazy<Regex> = Lazy::new(|| {
80+
Regex::new(r"^/v5/channel/0x([a-zA-Z0-9]{64})/spender/all/?$").expect("The regex should be valid")
81+
});
8082

8183
#[derive(Debug, Clone)]
8284
pub struct RouteParams(pub Vec<String>);
@@ -396,14 +398,17 @@ async fn channels_router<A: Adapter + 'static>(
396398
get_spender_limits(req, app).await
397399
} else if let (Some(caps), &Method::GET) = (CHANNEL_ALL_SPENDER_LIMITS.captures(&path), method)
398400
{
399-
req = AuthRequired.call(req, app).await?;
400401

401402
let param = RouteParams(vec![caps
402403
.get(1)
403404
.map_or("".to_string(), |m| m.as_str().to_string())]);
404405
req.extensions_mut().insert(param);
405406

406-
req = ChannelLoad.call(req, app).await?;
407+
req = Chain::new()
408+
.chain(AuthRequired)
409+
.chain(ChannelLoad)
410+
.apply(req, app)
411+
.await?;
407412

408413
get_all_spender_limits(req, app).await
409414
} else {

0 commit comments

Comments
 (0)