1818
1919use std:: { convert:: TryFrom , str:: FromStr } ;
2020
21+ use fluent_uri:: Uri as Url ;
2122use packageurl:: PackageUrl ;
2223use thiserror:: Error ;
2324
@@ -74,7 +75,7 @@ impl TryFrom<String> for Uri {
7475 type Error = UriError ;
7576
7677 fn try_from ( value : String ) -> Result < Self , Self :: Error > {
77- match value . parse :: < http :: Uri > ( ) {
78+ match Url :: parse ( value . as_str ( ) ) {
7879 Ok ( _) => Ok ( Uri ( value) ) ,
7980 Err ( _) => Err ( UriError :: InvalidUri (
8081 "Uri does not conform to RFC 3986" . to_string ( ) ,
@@ -88,11 +89,11 @@ impl Validate for Uri {
8889 & self ,
8990 context : ValidationContext ,
9091 ) -> Result < ValidationResult , ValidationError > {
91- match self . 0 . parse :: < http :: Uri > ( ) {
92+ match Url :: parse ( & self . 0 . to_string ( ) ) {
9293 Ok ( _) => Ok ( ValidationResult :: Passed ) ,
9394 Err ( _) => Ok ( ValidationResult :: Failed {
9495 reasons : vec ! [ FailureReason {
95- message: "Uri does not conform to ISO 8601 " . to_string( ) ,
96+ message: "Uri does not conform to RFC 3986 " . to_string( ) ,
9697 context,
9798 } ] ,
9899 } ) ,
@@ -169,7 +170,7 @@ mod test {
169170 validation_result,
170171 ValidationResult :: Failed {
171172 reasons: vec![ FailureReason {
172- message: "Uri does not conform to ISO 8601 " . to_string( ) ,
173+ message: "Uri does not conform to RFC 3986 " . to_string( ) ,
173174 context: ValidationContext :: default ( )
174175 } ]
175176 }
0 commit comments