diff --git a/actix-files/src/path_buf.rs b/actix-files/src/path_buf.rs index fdd69c10c..03b2cd766 100644 --- a/actix-files/src/path_buf.rs +++ b/actix-files/src/path_buf.rs @@ -29,6 +29,8 @@ impl PathBufWrap { // equivalent to `path.split('/').count()` 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) .decode_utf8() .map_err(|_| UriSegmentError::NotValidUtf8)?;