Skip to content

Commit 0bf0a83

Browse files
committed
Update CHANGELOG.md
1 parent b403c6d commit 0bf0a83

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ This project uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
1010
- More characters are added to the encoding set to ensure recursive values
1111
(e.g. URLs as a value) decode reliably.
1212

13+
### Fixed
14+
15+
- The hash character `#` is now encoded in order to ensure correct parsing of query parameters.
16+
1317
## [0.4.0] - 2023-07-08
1418

1519
### Added

src/lib.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,24 @@
2323

2424
use std::fmt::{Debug, Display, Formatter};
2525

26-
use percent_encoding::{AsciiSet, CONTROLS, utf8_percent_encode};
26+
use percent_encoding::{utf8_percent_encode, AsciiSet, CONTROLS};
2727

2828
/// 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'>')
3035
// The following values are not strictly required by RFC 3986 but could help resolving recursion
3136
// where a URL is passed as a value. In these cases, occurrences of equal signs and ampersands
3237
// could break parsing.
3338
// By a similar logic, encoding the percent sign helps to resolve ambiguity.
3439
// 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'+');
3644

3745
/// A query string builder for percent encoding key-value pairs.
3846
///
@@ -381,6 +389,7 @@ mod tests {
381389

382390
assert_eq!(
383391
format!("https://example.com/{qs}"),
384-
format!("https://example.com/?{expected}"));
392+
format!("https://example.com/?{expected}")
393+
);
385394
}
386395
}

0 commit comments

Comments
 (0)