From a9840e8715c87073c8a98589b1824e2c8e7e3807 Mon Sep 17 00:00:00 2001 From: Razz4780 Date: Fri, 29 Nov 2024 18:54:14 +0100 Subject: [PATCH] Added local filter for hidden paths inside HOME directory --- changelog.d/+hidden-home-files-filter.changed.md | 1 + mirrord/layer/src/file/filter/read_local_by_default.rs | 5 +++++ 2 files changed, 6 insertions(+) create mode 100644 changelog.d/+hidden-home-files-filter.changed.md diff --git a/changelog.d/+hidden-home-files-filter.changed.md b/changelog.d/+hidden-home-files-filter.changed.md new file mode 100644 index 00000000000..664d2ad0c92 --- /dev/null +++ b/changelog.d/+hidden-home-files-filter.changed.md @@ -0,0 +1 @@ +Hidden files and directories in `$HOME` directory are now read locally by default. \ No newline at end of file diff --git a/mirrord/layer/src/file/filter/read_local_by_default.rs b/mirrord/layer/src/file/filter/read_local_by_default.rs index e199cfb55c6..875910cc273 100644 --- a/mirrord/layer/src/file/filter/read_local_by_default.rs +++ b/mirrord/layer/src/file/filter/read_local_by_default.rs @@ -92,5 +92,10 @@ pub fn regex_set_builder() -> RegexSetBuilder { patterns.push(format!("{}$", regex::escape(&executable.to_string_lossy()))); } + // Hidden files and directories in $HOME. + if let Ok(home) = env::var("HOME") { + patterns.push(format!("^{}/\\.", regex::escape(&home))) + } + RegexSetBuilder::new(patterns) }