Skip to content

Commit

Permalink
add example to README
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAlgorythm committed Dec 4, 2023
1 parent 1018fb7 commit a1dacc6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,12 @@
[![crev reviews](https://web.crev.dev/rust-reviews/badge/crev_count/path_ratchet.svg)](https://web.crev.dev/rust-reviews/crate/path_ratchet/)

Prevent path traversal attacks at type level.

```Rust
use std::path::PathBuf;
use path_ratchet::prelude::*;

let user_input = "/etc/shadow";
let mut filename = PathBuf::from("/tmp");
filename.push_component(SinglePathComponent::new(user_input).unwrap());
```
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
//! let mut filename = PathBuf::from("/tmp");
//! filename.push_component(SinglePathComponent::new(user_input).unwrap());
//! # }
//! ```

#[cfg(test)]
mod tests;
Expand Down

0 comments on commit a1dacc6

Please sign in to comment.