From 2d3a02c48a0c96b1a5db3d2046b627b87e72e211 Mon Sep 17 00:00:00 2001 From: Ho 229 Date: Sun, 15 Dec 2024 16:11:58 +0800 Subject: [PATCH] fix: use explicit `stat` instead of `Entry::metadata` in `fetch_placeholders` --- integrations/cloud_filter/src/lib.rs | 2 +- integrations/cloud_filter/tests/behavior/fetch_data.rs | 4 ++-- integrations/cloud_filter/tests/behavior/utils.rs | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/integrations/cloud_filter/src/lib.rs b/integrations/cloud_filter/src/lib.rs index 24ace0324144..fd9699e3b4bf 100644 --- a/integrations/cloud_filter/src/lib.rs +++ b/integrations/cloud_filter/src/lib.rs @@ -216,7 +216,7 @@ impl Filter for CloudFilter { })? .filter_map(|e| async { let entry = e.ok()?; - let metadata = entry.metadata(); + let metadata = self.op.stat(&entry.path()).await.ok()?; let entry_remote_path = PathBuf::from(entry.path()); let relative_path = entry_remote_path .strip_prefix(&remote_path) diff --git a/integrations/cloud_filter/tests/behavior/fetch_data.rs b/integrations/cloud_filter/tests/behavior/fetch_data.rs index 739c2736bd58..46a65d6edfad 100644 --- a/integrations/cloud_filter/tests/behavior/fetch_data.rs +++ b/integrations/cloud_filter/tests/behavior/fetch_data.rs @@ -43,8 +43,8 @@ pub fn test_fetch_data() -> Result<(), Failed> { assert_eq!( expected_content, - file_content(&path).expect("file hash"), - "file hash", + file_content(&path).expect("file content"), + "file content", ) } Ok(()) diff --git a/integrations/cloud_filter/tests/behavior/utils.rs b/integrations/cloud_filter/tests/behavior/utils.rs index 105cc4064d87..7f617ec3850b 100644 --- a/integrations/cloud_filter/tests/behavior/utils.rs +++ b/integrations/cloud_filter/tests/behavior/utils.rs @@ -35,7 +35,8 @@ pub fn file_content(path: impl Display) -> anyhow::Result { let content = powershell_script::run(&format!("Get-Content \"{path}\"")) .context("run powershell")? .stdout() - .unwrap_or_default(); + .unwrap_or_default() + .replace("\r\n", "\n"); // powershell returns CRLF, but the fixtures use LF Ok(content) }