From 2a7eac01bb56b82031a5e1e4634256a66bcde040 Mon Sep 17 00:00:00 2001 From: Sergio Benitez Date: Tue, 19 Apr 2022 13:06:02 -0700 Subject: [PATCH] Fix 'Segments::to_path_buf()' on Windows. --- core/http/src/uri/segments.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/core/http/src/uri/segments.rs b/core/http/src/uri/segments.rs index 526c8173..f42596eb 100644 --- a/core/http/src/uri/segments.rs +++ b/core/http/src/uri/segments.rs @@ -215,12 +215,10 @@ impl<'a> Segments<'a, Path> { return Err(PathError::BadEnd('<')) } else if segment.contains('/') { return Err(PathError::BadChar('/')) - } else if cfg!(windows) { - if segment.contains('\\') { - return Err(PathError::BadChar('\\')) - } else if segment.contains(':') { - return Err(PathError::BadChar(':')) - } + } else if cfg!(windows) && segment.contains('\\') { + return Err(PathError::BadChar('\\')) + } else if cfg!(windows) && segment.contains(':') { + return Err(PathError::BadChar(':')) } else { buf.push(&*segment) }