Skip to content

Commit 31d1593

Browse files
committed
qt-build-utils: allow underscores in QML uris
1 parent b4a8bcc commit 31d1593

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

crates/qt-build-utils/src/qml/qmluri.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ impl QmlUri {
2323
let uri: Vec<_> = uri.into_iter().map(Into::into).collect();
2424

2525
// Only allow alphanumeric uri parts for now
26-
if uri
27-
.iter()
28-
.any(|part| part.chars().any(|c| !c.is_ascii_alphanumeric()))
29-
{
30-
panic!("QML uri parts must be alphanumeric");
26+
if uri.iter().any(|part| {
27+
part.chars()
28+
.any(|c| !(c.is_ascii_alphanumeric() || c == '_'))
29+
}) {
30+
panic!("QML uri parts must be alphanumeric: {uri:?}");
3131
}
3232

3333
Self { uri }
@@ -67,9 +67,9 @@ mod test {
6767

6868
#[test]
6969
fn as_n() {
70-
let uri = QmlUri::new(["a", "b", "c"]);
71-
assert_eq!(uri.as_dirs(), "a/b/c");
72-
assert_eq!(uri.as_dots(), "a.b.c");
73-
assert_eq!(uri.as_underscores(), "a_b_c");
70+
let uri = QmlUri::new(["a", "b", "c_d"]);
71+
assert_eq!(uri.as_dirs(), "a/b/c_d");
72+
assert_eq!(uri.as_dots(), "a.b.c_d");
73+
assert_eq!(uri.as_underscores(), "a_b_c_d");
7474
}
7575
}

0 commit comments

Comments
 (0)