Skip to content

Commit

Permalink
fix: make sure the name starts with a letter or underscore or dot
Browse files Browse the repository at this point in the history
  • Loading branch information
evilsocket committed Oct 30, 2024
1 parent 5e80b8c commit fc856ce
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/core/handlers/onnx/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,14 @@ fn in_range(low: char, c: char, high: char) -> bool {

fn str_to_node_name(s: &str) -> String {
let mut result = String::new();

// make sure the name starts with a letter or underscore or dot
if let Some(first) = s.chars().next() {
if !is_letter_or_underscore_or_dot(first) {
result.push('_');
}
}

for c in s.chars() {
if is_constituent(c) {
result.push(c);
Expand Down

0 comments on commit fc856ce

Please sign in to comment.