mirror of
https://github.com/xHyroM/zed-discord-presence.git
synced 2024-11-14 10:28:07 +01:00
fix: decode uri (#15)
* fix: decode uri closes https://github.com/xhyrom/zed-discord-presence/issues/14 * refactor: remove
This commit is contained in:
parent
917a011970
commit
0449fef97f
4 changed files with 15 additions and 4 deletions
7
Cargo.lock
generated
7
Cargo.lock
generated
|
@ -133,6 +133,7 @@ dependencies = [
|
|||
"serde_json",
|
||||
"tokio",
|
||||
"tower-lsp",
|
||||
"urlencoding",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -851,6 +852,12 @@ dependencies = [
|
|||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "urlencoding"
|
||||
version = "2.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da"
|
||||
|
||||
[[package]]
|
||||
name = "uuid"
|
||||
version = "0.8.2"
|
||||
|
|
|
@ -11,3 +11,4 @@ git2 = { version = "0.19.0", default-features = false }
|
|||
serde_json = { version = "1.0.122", features = ["std"] }
|
||||
lazy_static = "1.5.0"
|
||||
regex = { version = "1.10.6", default-features = false, features = ["std", "perf", "unicode-case"] }
|
||||
urlencoding = "2.1.3"
|
||||
|
|
|
@ -62,8 +62,11 @@ impl Document {
|
|||
}
|
||||
}
|
||||
|
||||
fn get_filename(&self) -> &str {
|
||||
self.path.file_name().unwrap().to_str().unwrap()
|
||||
fn get_filename(&self) -> String {
|
||||
let filename = self.path.file_name().unwrap().to_str().unwrap();
|
||||
let filename = urlencoding::decode(filename).unwrap();
|
||||
|
||||
filename.to_string()
|
||||
}
|
||||
|
||||
fn get_extension(&self) -> &str {
|
||||
|
|
|
@ -13,7 +13,7 @@ macro_rules! replace_with_capitalization {
|
|||
}
|
||||
|
||||
pub struct Placeholders<'a> {
|
||||
filename: &'a str,
|
||||
filename: String,
|
||||
workspace: &'a str,
|
||||
language: String,
|
||||
base_icons_url: &'a str,
|
||||
|
@ -32,7 +32,7 @@ impl<'a> Placeholders<'a> {
|
|||
pub fn replace(&self, text: &str) -> String {
|
||||
replace_with_capitalization!(
|
||||
text,
|
||||
"filename" => self.filename,
|
||||
"filename" => self.filename.as_str(),
|
||||
"workspace" => self.workspace,
|
||||
"language" => self.language.as_str(),
|
||||
"base_icons_url" => self.base_icons_url
|
||||
|
|
Loading…
Reference in a new issue