diff --git a/CHANGELOG.md b/CHANGELOG.md index 2146e69..b361fac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,3 +6,5 @@ ### Patch +- Forked [l1h3r/did_url](https://github.com/l1h3r/did_url) and fixed a bug that made +valid DID URLs containing `%`-encoded characters unparsable. diff --git a/Cargo.toml b/Cargo.toml index 31c2925..2abb7b6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "did_url_parser" version = "0.2.0" authors = ["IOTA Stiftung"] -edition = "2018" +edition = "2021" license = "MIT OR Apache-2.0" description = "A no_std parser for Decentralized Identifiers (DIDs)" repository = "https://github.com/iotaledger/did_url" diff --git a/README.md b/README.md index 2abc881..e655f4e 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ **A parser for Decentralized Identifiers (DIDs)** -A fork of https://github.com/l1h3r/did_url +A fork of [l1h3r/did_url](https://github.com/l1h3r/did_url). --- diff --git a/src/core.rs b/src/core.rs index 21270a9..52e1b00 100644 --- a/src/core.rs +++ b/src/core.rs @@ -89,10 +89,7 @@ impl Core { } pub(crate) fn set_path(&mut self, buffer: &mut String, value: &str) { - let end: u32 = self - .query - .or(self.fragment) - .unwrap_or_else(|| buffer.len() as u32); + let end: u32 = self.query.or(self.fragment).unwrap_or(buffer.len() as u32); let int: Int = Int::new(end, self.path + value.len() as u32); @@ -111,7 +108,7 @@ impl Core { self.query = Some(fragment); self.fragment = Some(fragment + value.len() as u32 + 1); - buffer.insert_str(fragment as usize, "?"); + buffer.insert(fragment as usize, '?'); buffer.insert_str(fragment as usize + 1, value); } (Some(query), Some(fragment), Some(value)) => { diff --git a/src/did.rs b/src/did.rs index 7719949..4ba7c4a 100644 --- a/src/did.rs +++ b/src/did.rs @@ -69,7 +69,7 @@ impl DID { /// This is fast since the serialized value is stored in the [`DID`]. #[inline] pub fn as_str(&self) -> &str { - &*self.data + &self.data } /// Consumes the [`DID`] and returns the serialization. @@ -194,7 +194,7 @@ impl Eq for DID {} impl PartialOrd for DID { fn partial_cmp(&self, other: &Self) -> Option { - self.as_str().partial_cmp(other.as_str()) + Some(self.cmp(other)) } }