This is an automated email from the ASF dual-hosted git repository. xuanwo pushed a commit to branch list-prefix in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git
commit ddd1376241107ebb42e37b15c7a64d2fe08b6659 Author: Xuanwo <[email protected]> AuthorDate: Thu Dec 7 13:23:44 2023 +0800 Remove limit on list prefix Signed-off-by: Xuanwo <[email protected]> --- core/src/types/operator/blocking_operator.rs | 24 +----------------------- core/src/types/operator/operator.rs | 24 +----------------------- core/tests/behavior/list.rs | 8 ++++---- 3 files changed, 6 insertions(+), 50 deletions(-) diff --git a/core/src/types/operator/blocking_operator.rs b/core/src/types/operator/blocking_operator.rs index f811eeedb..d3efad854 100644 --- a/core/src/types/operator/blocking_operator.rs +++ b/core/src/types/operator/blocking_operator.rs @@ -1024,16 +1024,6 @@ impl BlockingOperator { path, OpList::default(), |inner, path, args| { - if !validate_path(&path, EntryMode::DIR) { - return Err(Error::new( - ErrorKind::NotADirectory, - "the path trying to list should end with `/`", - ) - .with_operation("BlockingOperator::list") - .with_context("service", inner.info().scheme().into_static()) - .with_context("path", &path)); - } - let lister = BlockingLister::create(inner, &path, args)?; lister.collect() @@ -1197,19 +1187,7 @@ impl BlockingOperator { self.inner().clone(), path, OpList::default(), - |inner, path, args| { - if !validate_path(&path, EntryMode::DIR) { - return Err(Error::new( - ErrorKind::NotADirectory, - "the path trying to list should end with `/`", - ) - .with_operation("BlockingOperator::list") - .with_context("service", inner.info().scheme().into_static()) - .with_context("path", &path)); - } - - BlockingLister::create(inner, &path, args) - }, + |inner, path, args| BlockingLister::create(inner, &path, args), )) } } diff --git a/core/src/types/operator/operator.rs b/core/src/types/operator/operator.rs index 635577976..3e961fdae 100644 --- a/core/src/types/operator/operator.rs +++ b/core/src/types/operator/operator.rs @@ -1153,16 +1153,6 @@ impl Operator { OpList::default(), |inner, path, args| { let fut = async move { - if !validate_path(&path, EntryMode::DIR) { - return Err(Error::new( - ErrorKind::NotADirectory, - "the path trying to list should end with `/`", - ) - .with_operation("Operator::list") - .with_context("service", inner.info().scheme().into_static()) - .with_context("path", &path)); - } - let lister = Lister::create(inner, &path, args).await?; lister.try_collect().await @@ -1330,19 +1320,7 @@ impl Operator { path, OpList::default(), |inner, path, args| { - let fut = async move { - if !validate_path(&path, EntryMode::DIR) { - return Err(Error::new( - ErrorKind::NotADirectory, - "the path trying to list should end with `/`", - ) - .with_operation("Operator::list") - .with_context("service", inner.info().scheme().into_static()) - .with_context("path", &path)); - } - - Lister::create(inner, &path, args).await - }; + let fut = async move { Lister::create(inner, &path, args).await }; Box::pin(fut) }, )); diff --git a/core/tests/behavior/list.rs b/core/tests/behavior/list.rs index 64911f8fa..5c8007d47 100644 --- a/core/tests/behavior/list.rs +++ b/core/tests/behavior/list.rs @@ -46,8 +46,8 @@ pub fn behavior_list_tests(op: &Operator) -> Vec<Trial> { test_list_nested_dir, test_list_dir_with_file_path, test_list_with_start_after, - test_scan, - test_scan_root, + test_list_with_recursive, + test_list_root_with_recursive, test_remove_all ) } @@ -365,7 +365,7 @@ pub async fn test_list_with_start_after(op: Operator) -> Result<()> { Ok(()) } -pub async fn test_scan_root(op: Operator) -> Result<()> { +pub async fn test_list_root_with_recursive(op: Operator) -> Result<()> { let w = op.lister_with("").recursive(true).await?; let actual = w .try_collect::<Vec<_>>() @@ -380,7 +380,7 @@ pub async fn test_scan_root(op: Operator) -> Result<()> { } // Walk top down should output as expected -pub async fn test_scan(op: Operator) -> Result<()> { +pub async fn test_list_with_recursive(op: Operator) -> Result<()> { let parent = uuid::Uuid::new_v4().to_string(); let expected = [
