File tree Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,10 @@ This project uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
10
10
- More characters are added to the encoding set to ensure recursive values
11
11
(e.g. URLs as a value) decode reliably.
12
12
13
+ ### Fixed
14
+
15
+ - The hash character ` # ` is now encoded in order to ensure correct parsing of query parameters.
16
+
13
17
## [ 0.4.0] - 2023-07-08
14
18
15
19
### Added
Original file line number Diff line number Diff line change 23
23
24
24
use std:: fmt:: { Debug , Display , Formatter } ;
25
25
26
- use percent_encoding:: { AsciiSet , CONTROLS , utf8_percent_encode } ;
26
+ use percent_encoding:: { utf8_percent_encode , AsciiSet , CONTROLS } ;
27
27
28
28
/// https://url.spec.whatwg.org/#query-percent-encode-set
29
- const QUERY : & AsciiSet = & CONTROLS . add ( b' ' ) . add ( b'"' ) . add ( b'#' ) . add ( b'<' ) . add ( b'>' )
29
+ const QUERY : & AsciiSet = & CONTROLS
30
+ . add ( b' ' )
31
+ . add ( b'"' )
32
+ . add ( b'#' )
33
+ . add ( b'<' )
34
+ . add ( b'>' )
30
35
// The following values are not strictly required by RFC 3986 but could help resolving recursion
31
36
// where a URL is passed as a value. In these cases, occurrences of equal signs and ampersands
32
37
// could break parsing.
33
38
// By a similar logic, encoding the percent sign helps to resolve ambiguity.
34
39
// The plus sign is also added to the set as to not confuse it with a space.
35
- . add ( b'%' ) . add ( b'&' ) . add ( b'=' ) . add ( b'+' ) ;
40
+ . add ( b'%' )
41
+ . add ( b'&' )
42
+ . add ( b'=' )
43
+ . add ( b'+' ) ;
36
44
37
45
/// A query string builder for percent encoding key-value pairs.
38
46
///
@@ -381,6 +389,7 @@ mod tests {
381
389
382
390
assert_eq ! (
383
391
format!( "https://example.com/{qs}" ) ,
384
- format!( "https://example.com/?{expected}" ) ) ;
392
+ format!( "https://example.com/?{expected}" )
393
+ ) ;
385
394
}
386
395
}
You can’t perform that action at this time.
0 commit comments