Skip to content

Commit

Permalink
Remove illegal characters
Browse files Browse the repository at this point in the history
  • Loading branch information
dianhsu committed Jan 17, 2024
1 parent 3eef1f8 commit 9984d46
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 4 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, String> {
let mut groups: Vec<String> = Vec::new();
if SERVER_CONFIG.short_path {
Expand All @@ -39,7 +39,9 @@ async fn get_path(task: &model::Task) -> Result<String, String> {
}
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);
Expand Down

0 comments on commit 9984d46

Please sign in to comment.