This commit is contained in:
Ali MJ Al-Nasrawy 2022-01-04 15:26:48 +03:00
parent 6dacc34286
commit 6f40b60bd4
1 changed files with 2 additions and 0 deletions

View File

@ -29,6 +29,8 @@ impl PathBufWrap {
// equivalent to `path.split('/').count()` // equivalent to `path.split('/').count()`
let mut segment_count = path.matches('/').count() + 1; let mut segment_count = path.matches('/').count() + 1;
// we can decode the whole path here (instead of per-segment decoding)
// because we will reject `%2F` in paths using `segement_count`.
let path = percent_encoding::percent_decode_str(path) let path = percent_encoding::percent_decode_str(path)
.decode_utf8() .decode_utf8()
.map_err(|_| UriSegmentError::NotValidUtf8)?; .map_err(|_| UriSegmentError::NotValidUtf8)?;