diff --git a/Cargo.lock b/Cargo.lock index ece2bec..12361f0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -211,7 +211,7 @@ dependencies = [ [[package]] name = "ccs" -version = "0.1.9" +version = "0.1.10" dependencies = [ "axum", "chrono", diff --git a/Cargo.toml b/Cargo.toml index be0ee64..49fc676 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ccs" -version = "0.1.9" +version = "0.1.10" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/src/main.rs b/src/main.rs index dc74c47..b8adf1d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,7 +13,7 @@ use log::LevelFilter; use std::io::Write; #[macro_use] extern crate lazy_static; - +const ILLEGAL_CHARS: [char; 10] = ['\\', '/', ':', '*', '?', '"', '<', '>', '|', '\0']; async fn get_path(task: &model::Task) -> Result { let mut groups: Vec = Vec::new(); if SERVER_CONFIG.short_path { @@ -39,7 +39,9 @@ async fn get_path(task: &model::Task) -> Result { } if groups.is_empty() { let mut contest = task.group.clone(); - contest = contest.replace(':', ""); + for illegal_char in ILLEGAL_CHARS.iter() { + contest = contest.replace(*illegal_char, "_"); + } groups.push(contest); let problem = task.name.clone(); groups.push(problem);