From 166080aac8919b18bad0f6ed30cf356d7c493fb6 Mon Sep 17 00:00:00 2001 From: shiro Date: Wed, 9 Jul 2025 20:32:20 +0800 Subject: [PATCH] fix: troubleshooting startup failure in Windows System --- crates/ecstore/src/disk/local.rs | 4 ++-- crates/ecstore/src/store.rs | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/ecstore/src/disk/local.rs b/crates/ecstore/src/disk/local.rs index acb3b97a7..eeff61ba9 100644 --- a/crates/ecstore/src/disk/local.rs +++ b/crates/ecstore/src/disk/local.rs @@ -145,8 +145,8 @@ impl Debug for LocalDisk { impl LocalDisk { pub async fn new(ep: &Endpoint, cleanup: bool) -> Result { debug!("Creating local disk"); - let root = match fs::canonicalize(ep.get_file_path()).await { - Ok(path) => path, + let root = match PathBuf::from(ep.get_file_path()).absolutize() { + Ok(path) => path.into_owned(), Err(e) => { if e.kind() == ErrorKind::NotFound { return Err(DiskError::VolumeNotFound); diff --git a/crates/ecstore/src/store.rs b/crates/ecstore/src/store.rs index 85fbeecc9..9b06a4f98 100644 --- a/crates/ecstore/src/store.rs +++ b/crates/ecstore/src/store.rs @@ -2508,14 +2508,14 @@ fn check_object_name_for_length_and_slash(bucket: &str, object: &str) -> Result< #[cfg(target_os = "windows")] { - if object.contains('\\') - || object.contains(':') + if object.contains(':') || object.contains('*') || object.contains('?') || object.contains('"') || object.contains('|') || object.contains('<') || object.contains('>') + // || object.contains('\\') { return Err(StorageError::ObjectNameInvalid(bucket.to_owned(), object.to_owned())); } @@ -2549,9 +2549,9 @@ fn check_bucket_and_object_names(bucket: &str, object: &str) -> Result<()> { return Err(StorageError::ObjectNameInvalid(bucket.to_string(), object.to_string())); } - if cfg!(target_os = "windows") && object.contains('\\') { - return Err(StorageError::ObjectNameInvalid(bucket.to_string(), object.to_string())); - } + // if cfg!(target_os = "windows") && object.contains('\\') { + // return Err(StorageError::ObjectNameInvalid(bucket.to_string(), object.to_string())); + // } Ok(()) }