Skip to content

Commit 97d31b6

Browse files
A6GibKmbilelmoussaoui
authored andcommitted
server: collection: Use replace for sanitizing
1 parent e7b2f61 commit 97d31b6

1 file changed

Lines changed: 1 addition & 10 deletions

File tree

server/src/collection/mod.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -391,16 +391,7 @@ impl Collection {
391391
let modified = keyring.modified_time().await;
392392
let created = keyring.created_time().await.unwrap_or(modified);
393393

394-
let sanitized_label = label
395-
.chars()
396-
.map(|c| {
397-
if c.is_ascii_alphanumeric() || c == '_' {
398-
c
399-
} else {
400-
'_'
401-
}
402-
})
403-
.collect::<String>();
394+
let sanitized_label = label.replace(|c: char| !c.is_ascii_alphanumeric() && c != '_', "_");
404395

405396
Self {
406397
items: Default::default(),

0 commit comments

Comments
 (0)