Skip to content

Commit 291ec0b

Browse files
committed
Improve API and break backwards-compatibility
1 parent e99a8d1 commit 291ec0b

File tree

2 files changed

+227
-478
lines changed

2 files changed

+227
-478
lines changed

core/http/src/uri/segments.rs

-33
Original file line numberDiff line numberDiff line change
@@ -245,39 +245,6 @@ impl<'a> Segments<'a, Path> {
245245

246246
Ok(buf)
247247
}
248-
249-
/// Similar to `to_path_buf`, but always allows dotfiles, and reports whether
250-
/// the path contains dotfiles.
251-
pub fn to_path_buf_dotfiles(&self) -> Result<(PathBuf, bool), PathError> {
252-
let mut buf = PathBuf::new();
253-
let mut is_dotfile = false;
254-
for segment in self.clone() {
255-
if segment == ".." {
256-
buf.pop();
257-
} else if segment.starts_with('.') {
258-
buf.push(segment);
259-
is_dotfile = true;
260-
} else if segment.starts_with('*') {
261-
return Err(PathError::BadStart('*'))
262-
} else if segment.ends_with(':') {
263-
return Err(PathError::BadEnd(':'))
264-
} else if segment.ends_with('>') {
265-
return Err(PathError::BadEnd('>'))
266-
} else if segment.ends_with('<') {
267-
return Err(PathError::BadEnd('<'))
268-
} else if segment.contains('/') {
269-
return Err(PathError::BadChar('/'))
270-
} else if cfg!(windows) && segment.contains('\\') {
271-
return Err(PathError::BadChar('\\'))
272-
} else if cfg!(windows) && segment.contains(':') {
273-
return Err(PathError::BadChar(':'))
274-
} else {
275-
buf.push(segment)
276-
}
277-
}
278-
279-
Ok((buf, is_dotfile))
280-
}
281248
}
282249

283250
impl<'a> Segments<'a, Query> {

0 commit comments

Comments
 (0)