Skip to content

Commit

Permalink
Limit file length
Browse files Browse the repository at this point in the history
Signed-off-by: Sean Young <sean@mess.org>
  • Loading branch information
seanyoung committed Jun 18, 2024
1 parent db9bc8d commit 0d16490
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions irp/src/build_dfa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,14 @@ impl<'a> Options<'a> {
pub(crate) fn filename(&self, ext: &str) -> String {
// characters not allowed on Windows/Mac/Linux: https://stackoverflow.com/a/35352640

let limit = 255 - ext.len();

self.name
.chars()
.filter(|c| !matches!(c, ':' | '/' | '\\' | '*' | '?' | '"' | '<' | '>' | '|'))
.enumerate()
.filter(|(i, _)| *i < limit)
.map(|(_, c)| c)
.chain(ext.chars())
.collect::<String>()
}
Expand Down

0 comments on commit 0d16490

Please sign in to comment.