diff --git a/src/de.rs b/src/de.rs index fd7e84e..7080130 100644 --- a/src/de.rs +++ b/src/de.rs @@ -42,6 +42,16 @@ impl<'a, T: DeserializeParams<'a>> Uri<'a, bitcoin::address::NetworkUnchecked, T let mut label = None; let mut message = None; if let Some(params) = params { + // [RFC 3986 ยง 3.4](https://www.rfc-editor.org/rfc/rfc3986#section-3.4): + // + // > The query component is indicated by the first question + // > mark ("?") character and terminated by a number sign ("#") character + // > or by the end of the URI. + let params = match params.find('#') { + Some(pos) => ¶ms[..pos], + None => params, + }; + for param in params.split('&') { let pos = param .find('=') diff --git a/src/ser.rs b/src/ser.rs index 678b669..a77ca6a 100644 --- a/src/ser.rs +++ b/src/ser.rs @@ -59,9 +59,9 @@ impl<'a, W: fmt::Write> fmt::Write for EqSignChecker<'a, W> { /// > otherparam = qchar *qchar [ "=" *qchar ] /// > ``` /// ... -/// > Here, "qchar" corresponds to valid characters of an RFC 3986 URI > query -/// component, excluding the "=" and "&" characters, which this BIP > takes as -/// separators. +/// > Here, "qchar" corresponds to valid characters of an RFC 3986 URI query +/// > component, excluding the "=" and "&" characters, which this BIP takes as +/// > separators. /// /// [RFC 3986 Appendix A](https://www.rfc-editor.org/rfc/rfc3986#appendix-A): ///