rimage icon indicating copy to clipboard operation
rimage copied to clipboard

[Bug]: err when using extremely special filename

Open Mikachu2333 opened this issue 1 year ago • 0 comments

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

  1. rename a pic
  2. 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
}

Mikachu2333 avatar Aug 23 '24 18:08 Mikachu2333