Skip to content

Commit fc856ce

Browse files
committed
fix: make sure the name starts with a letter or underscore or dot
1 parent 5e80b8c commit fc856ce

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/core/handlers/onnx/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,14 @@ fn in_range(low: char, c: char, high: char) -> bool {
127127

128128
fn str_to_node_name(s: &str) -> String {
129129
let mut result = String::new();
130+
131+
// make sure the name starts with a letter or underscore or dot
132+
if let Some(first) = s.chars().next() {
133+
if !is_letter_or_underscore_or_dot(first) {
134+
result.push('_');
135+
}
136+
}
137+
130138
for c in s.chars() {
131139
if is_constituent(c) {
132140
result.push(c);

0 commit comments

Comments
 (0)