You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by "rick-200 (via GitHub)" <gi...@apache.org> on 2025/02/23 07:17:36 UTC
[I] bug: Integration dav-server-opendalfs can not handle encoded path correctly [opendal]
rick-200 opened a new issue, #5649:
URL: https://github.com/apache/opendal/issues/5649
### Describe the bug
The currently implementation of dav-server-opendalfs will internally encode the url passed in by dav-server into %+ hex format and pass it to the dependent opendal Operator, thus accessing the wrong path.
For example, accessing '%CE%B1%CE%BB%CF%86%CE%AC%CE%B2%CE%B7%C' in dav-server-opendalfs should access decoded 'αλφάβητο' in underlying opendal service, however it actually access the encoded path currently.
### Steps to Reproduce
code to reproduce:
```rust
use dav_server::fakels::FakeLs;
use dav_server::DavHandler;
use dav_server_opendalfs::OpendalFs;
use hyper::body::Bytes;
use hyper::http;
use opendal::layers::LoggingLayer;
use opendal::{services, Operator};
use std::fs;
use tempfile::TempDir;
#[tokio::main]
async fn main() {
env_logger::builder().parse_filters("debug").init();
let tmp_dir = TempDir::with_prefix("test").unwrap();
let builder = services::Fs::default().root(tmp_dir.path().to_str().unwrap());
let op = Operator::new(builder)
.unwrap()
.layer(LoggingLayer::default())
.finish();
let webdavfs = OpendalFs::new(op);
let dav_server = DavHandler::builder()
.filesystem(webdavfs)
.locksystem(FakeLs::new())
.build_handler();
// http://localhost:8080/test_αλφάβητο/
let url_encoded = "http://localhost:8080/test_%CE%B1%CE%BB%CF%86%CE%AC%CE%B2%CE%B7%C/";
let req = http::request::Request::builder()
.method("MKCOL")
.uri(url_encoded)
.body(http_body_util::Empty::<Bytes>::new())
.unwrap();
dav_server.handle(req).await;
let entries = fs::read_dir(tmp_dir.path())
.unwrap()
.collect::<Result<Vec<_>, _>>()
.unwrap();
println!("{:?}", entries);
assert!(entries
.iter()
.any(|entry| entry.file_name() == "test_αλφάβητο"));
}
```
### Expected Behavior
dav-server-opendalfs should handle encoded path correctly
### Additional Context
_No response_
### Are you willing to submit a PR to fix this bug?
- [x] Yes, I would like to submit a PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] bug: Integration dav-server-opendalfs can not handle encoded path correctly [opendal]
Posted by "Xuanwo (via GitHub)" <gi...@apache.org>.
Xuanwo closed issue #5649: bug: Integration dav-server-opendalfs can not handle encoded path correctly
URL: https://github.com/apache/opendal/issues/5649
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@opendal.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org