rimage
rimage copied to clipboard
[Bug]: err when using extremely special filename
Is there an existing issue for this?
- [X] I have searched the existing issues
Description
As the title shows.
e.g.
".jpg (This is the full filename of a pic)
a dw/".jpg
(!!!I must be Crazy!!!)
Expected behavior
Success
Library Version
None
Steps To Reproduce
- rename a pic
- run the command
Anything else?
besides, maybe we'd better update the logic of path recognizing (I'll try to do that.)
Here's some code from my repo. (I also meet this problem)
fn rm_special(name: &str) -> String {
let mut temp = name.replace(r#"\"#, r#"/"#).replace(r#"//"#, r#"/"#);
while temp.ends_with(r#"""#) {
temp = temp[0..temp.len() - 2].to_string();
}
while name.ends_with(r#"\"#) {
temp = temp[0..temp.len() - 2].to_string();
}
while name.starts_with(r#"""#) {
temp = temp[1..temp.len() - 1].to_string();
}
temp
}