From be004e2cf2586e7c3f55bbde6068acfa4d282e56 Mon Sep 17 00:00:00 2001 From: Carter <60557606+Carterpersall@users.noreply.github.com> Date: Mon, 13 Nov 2023 11:39:22 -0600 Subject: [PATCH] Clarify error that occurs when getting the hash of an on-demand file (#1722) * Clarify Error - Clarifies error that occurs when attempting to read the metadata from an on-demand file * Make error more better Changed 'Attempted' to 'Failed' * Add comment and conditional compilation --- core/src/object/file_identifier/mod.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/core/src/object/file_identifier/mod.rs b/core/src/object/file_identifier/mod.rs index a948967e6..d1f03af86 100644 --- a/core/src/object/file_identifier/mod.rs +++ b/core/src/object/file_identifier/mod.rs @@ -124,7 +124,22 @@ async fn identifier_job_step( (metadata, file_path), ) }) - .map_err(|e| error!("Failed to extract file metadata: {e:#?}")) + .map_err(|e| { + #[cfg(target_os = "windows")] + { + // Handle case where file is on-demand (NTFS only) + if e.source.raw_os_error().map_or(false, |code| code == 362) { + error!("Failed to extract metadata from on-demand file: {e:#?}"); + } else { + error!("Failed to extract file metadata: {e:#?}") + } + } + + #[cfg(not(target_os = "windows"))] + { + error!("Failed to extract file metadata: {e:#?}"); + } + }) .ok() }), )