From dc249c0db450c920165ecf6c3a10e8cdf5e13caa Mon Sep 17 00:00:00 2001 From: Elias Rohrer Date: Mon, 21 Aug 2023 14:58:34 +0200 Subject: [PATCH] f Better handling of `relative_path` --- lightning-persister/src/fs_store.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lightning-persister/src/fs_store.rs b/lightning-persister/src/fs_store.rs index 5ccc4d8c3..c29f0fb05 100644 --- a/lightning-persister/src/fs_store.rs +++ b/lightning-persister/src/fs_store.rs @@ -259,8 +259,11 @@ impl KVStore for FilesystemStore { } } - if let Ok(relative_path) = p.strip_prefix(&prefixed_dest) { - keys.push(relative_path.display().to_string()) + if let Some(relative_path) = p.strip_prefix(&prefixed_dest).ok() + .and_then(|p| p.to_str()) { + if relative_path.chars().all(|c| c.is_ascii() && !c.is_control()) { + keys.push(relative_path.to_string()) + } } } -- 2.39.5