When root path contains spaces list operation fails with an error: path /My%20Directory/ doesn't start with root /My Directory/
Steps to Reproduce
Run Webdav serving a directory with a space in the name.
Set .root() on WebdavBuilder to that directory.
Try calling .list() operation.
Expected Behavior
List operation returns entries.
Additional Context
Panic log snippet:
thread 'downloader::webdav::tests::temp_test2' panicked at /home/skrimix/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opendal-0.50.1/src/raw/path.rs:71:9:
path /My%20Directory/ doesn't start with root /My Directory/
stack backtrace:
0: rust_begin_unwind
at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:665:5
1: core::panicking::panic_fmt
at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/panicking.rs:74:14
2: opendal::raw::path::build_rel_path
at /home/skrimix/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opendal-0.50.1/src/raw/path.rs:71:9
3: <opendal::services::webdav::lister::WebdavLister as opendal::raw::oio::list::page_list::PageList>::next_page::{{closure}}
at /home/skrimix/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opendal-0.50.1/src/services/webdav/lister.rs:88:35
4: <opendal::raw::oio::list::page_list::PageLister<L> as opendal::raw::oio::list::api::List>::next::{{closure}}
at /home/skrimix/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opendal-0.50.1/src/raw/oio/list/page_list.rs:100:49
5: <opendal::layers::error_context::ErrorContextWrapper<T> as opendal::raw::oio::list::api::List>::next::{{closure}}
at /home/skrimix/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opendal-0.50.1/src/layers/error_context.rs:453:14
6: <opendal::raw::enum_utils::FourWays<ONE,TWO,THREE,FOUR> as opendal::raw::oio::list::api::List>::next::{{closure}}
at /home/skrimix/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opendal-0.50.1/src/raw/enum_utils.rs:223:38
7: <opendal::layers::logging::LoggingLister<P,I> as opendal::raw::oio::list::api::List>::next::{{closure}}
at /home/skrimix/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opendal-0.50.1/src/layers/logging.rs:1269:37
8: <core::pin::Pin<P> as core::future::future::Future>::poll
at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/future/future.rs:123:9
9: <opendal::types::list::Lister as futures_core::stream::Stream>::poll_next::{{closure}}
at /home/skrimix/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opendal-0.50.1/src/types/list.rs:161:49
10: <opendal::types::list::Lister as futures_core::stream::Stream>::poll_next
at /home/skrimix/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opendal-0.50.1/src/types/list.rs:168:55
11: <S as futures_core::stream::TryStream>::try_poll_next
at /home/skrimix/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-core-0.3.31/src/stream.rs:206:9
12: <futures_util::stream::try_stream::try_collect::TryCollect<St,C> as core::future::future::Future>::poll
at /home/skrimix/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-util-0.3.31/src/stream/try_stream/try_collect.rs:46:26
13: opendal::types::operator::operator::Operator::list_with::{{closure}}::{{closure}}
at /home/skrimix/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opendal-0.50.1/src/types/operator/operator.rs:1755:38
14: opendal::types::operator::operator::Operator::list::{{closure}}
at /home/skrimix/.cargo/registry/src/index.crates.io-6f17d22bba15001f/opendal-0.50.1/src/types/operator/operator.rs:1593:30
Describe the bug
When root path contains spaces list operation fails with an error:
path /My%20Directory/ doesn't start with root /My Directory/
Steps to Reproduce
Expected Behavior
List operation returns entries.
Additional Context
Panic log snippet:
I think the problem is with this code. The condition and
build_rel_path
seem to check encoded path against non encoded root, which causes the issue. https://github.com/apache/opendal/blob/a594365a489af2fe5f97d7133808cbc4ec20792b/core/src/services/webdav/lister.rs#L83-L89Are you willing to submit a PR to fix this bug?