Skip to content

Commit 0074a0a

Browse files
committed
fs: sanitize colons from file requests on windows
1 parent 3cf1783 commit 0074a0a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/filters/fs.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,10 @@ fn sanitize_path(base: impl AsRef<Path>, tail: &str) -> Result<PathBuf, Rejectio
123123
tracing::warn!("dir: rejecting segment starting with '..'");
124124
return Err(reject::not_found());
125125
} else if seg.contains('\\') {
126-
tracing::warn!("dir: rejecting segment containing with backslash (\\)");
126+
tracing::warn!("dir: rejecting segment containing backslash (\\)");
127+
return Err(reject::not_found());
128+
} else if cfg!(windows) && seg.contains(':') {
129+
tracing::warn!("dir: rejecting segment containing colon (:)");
127130
return Err(reject::not_found());
128131
} else {
129132
buf.push(seg);

0 commit comments

Comments
 (0)