MCPcopy Create free account
hub / github.com/GCWing/BitFun / safe_file_stem

Function safe_file_stem

src/apps/desktop/src/api/context_upload_api.rs:188–202  ·  view source on GitHub ↗
(value: &str)

Source from the content-addressed store, hash-verified

186}
187
188fn safe_file_stem(value: &str) -> String {
189 let mut out = String::with_capacity(value.len().min(64));
190 for ch in value.chars().take(64) {
191 if ch.is_ascii_alphanumeric() || ch == '-' || ch == '_' {
192 out.push(ch);
193 } else {
194 out.push('_');
195 }
196 }
197 if out.is_empty() {
198 "image".to_string()
199 } else {
200 out
201 }
202}
203
204fn has_text(value: Option<&str>) -> bool {
205 value.is_some_and(|value| !value.trim().is_empty())

Callers

nothing calls this directly

Calls 4

takeMethod · 0.80
lenMethod · 0.45
pushMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected