Skip to content

Commit ccdaad7

Browse files
committed
fix: Allow underscore in SafeUrlPart
1 parent 67b622d commit ccdaad7

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

.envrc-example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ export FLY_ORG_SLUG="personal"
99
# App name: Either create fly.toml based on fly-example.toml and extract the app name, or just enter it here.
1010
export FLY_APP_NAME=$(grep '^app' fly.toml | sed -E 's/app *= *["'\'']([^"'\''"]+)["'\'']/\1/')
1111

12-
export FLY_IMAGE="getobelisk/obelisk:0.24.1-ubuntu"
12+
export FLY_IMAGE="getobelisk/obelisk:0.25.1-ubuntu"
1313
export FLY_MACHINE_NAME="machine"
1414
export FLY_REGION="ams"

activity/fly-http/impl/src/lib.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,16 @@ struct SafeUrlPart<T> {
3131
}
3232
impl<T> SafeUrlPart<T> {
3333
fn new(s: String) -> Result<SafeUrlPart<T>, anyhow::Error> {
34-
if s.chars().all(|c| c.is_ascii_alphanumeric() || c == '-') {
35-
Ok(SafeUrlPart {
36-
value: s,
37-
_phantom_data: PhantomData,
38-
})
39-
} else {
40-
bail!("illegal slug")
34+
if let Some(illegal) = s
35+
.chars()
36+
.find(|c| !c.is_ascii_alphanumeric() && *c != '-' && *c != '_')
37+
{
38+
bail!("illegal character: {}", illegal);
4139
}
40+
Ok(SafeUrlPart {
41+
value: s,
42+
_phantom_data: PhantomData,
43+
})
4244
}
4345
}
4446
impl<T> AsRef<str> for SafeUrlPart<T> {

0 commit comments

Comments
 (0)