Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Attachment path generation function may replace ~ characters in original filenames #156

Closed
ReagentX opened this issue Aug 6, 2023 · 0 comments · Fixed by #160
Closed
Assignees
Labels
bug Something isn't working crate: database Related to the database crate

Comments

@ReagentX
Copy link
Owner

ReagentX commented Aug 6, 2023

From @rllbe in #151:

/// Generate a MacOS path for an attachment
fn gen_macos_attachment(path: &str) -> String {
if path.starts_with('~') {
return path.replace('~', &home());
}
path.to_string()
}

Line 254 may replace not only the '~' characters at the beginning of path strings, but also those in the original filenames at the end of it, resulting in errors when copying attachments

Suggestion: It might be better to ensure that only the first '~' character is replaced:

            return format!("{}{}", &home(), &path[1..]);
@ReagentX ReagentX added bug Something isn't working crate: cli Related to the CLI crate labels Aug 6, 2023
@ReagentX ReagentX self-assigned this Aug 6, 2023
@ReagentX ReagentX moved this to Todo in 1.6: Checker Mallow Aug 6, 2023
@ReagentX ReagentX moved this from Todo to In Progress in 1.6: Checker Mallow Aug 20, 2023
ReagentX added a commit that referenced this issue Aug 20, 2023
@ReagentX ReagentX mentioned this issue Aug 20, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done in 1.6: Checker Mallow Aug 20, 2023
@ReagentX ReagentX added crate: database Related to the database crate and removed crate: cli Related to the CLI crate labels Aug 20, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working crate: database Related to the database crate
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

1 participant