diff options
Diffstat (limited to 'src/dirs.rs')
-rw-r--r-- | src/dirs.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/dirs.rs b/src/dirs.rs index 5dd2c35..53a433e 100644 --- a/src/dirs.rs +++ b/src/dirs.rs @@ -17,8 +17,13 @@ pub fn config_file() -> std::path::PathBuf { config_dir().join("config.json") } -pub fn db_file(email: &str) -> std::path::PathBuf { - cache_dir().join(format!("{}.json", email)) +const INVALID_PATH: &percent_encoding::AsciiSet = + &percent_encoding::CONTROLS.add(b'/').add(b'%').add(b':'); +pub fn db_file(server: &str, email: &str) -> std::path::PathBuf { + let server = + percent_encoding::percent_encode(server.as_bytes(), INVALID_PATH) + .to_string(); + cache_dir().join(format!("{}:{}.json", server, email)) } pub fn pid_file() -> std::path::PathBuf { |