mirror of
https://github.com/wisdgod/cursor-api.git
synced 2025-10-06 07:06:51 +08:00
v0.1.3-rc.3.3
限制 `TOKEN_DELIMITER` 为 ASCII 避免问题
This commit is contained in:
@@ -24,12 +24,12 @@ pub fn parse_string_from_env(key: &str, default: &str) -> String {
|
||||
std::env::var(key).unwrap_or_else(|_| default.to_string())
|
||||
}
|
||||
|
||||
pub fn parse_char_from_env(key: &str, default: char) -> char {
|
||||
pub fn parse_ascii_char_from_env(key: &str, default: char) -> char {
|
||||
std::env::var(key)
|
||||
.ok()
|
||||
.and_then(|v| {
|
||||
let chars: Vec<char> = v.chars().collect();
|
||||
if chars.len() == 1 {
|
||||
if chars.len() == 1 && chars[0].is_ascii() {
|
||||
Some(chars[0])
|
||||
} else {
|
||||
None
|
||||
|
Reference in New Issue
Block a user