christer-eriksson opened a new issue, #6577: URL: https://github.com/apache/opendal/issues/6577
### Describe the bug When using the read() method in opendal 0.54.0 opendal fail to read the content from the file ### Steps to Reproduce Create a file named "file with trailing white space " with some content in it Use the read method to read the file content. It will fail with Error. ### Expected Behavior I expect to be able to read the content of a file even if the file name ends with a white space ### Additional Context The calls in this snippet shows that the normalize_path in deed trims the string from any leading or trailing white space. ``` pub async fn read(&self, path: &str) -> Result<Buffer> { self.read_options(path, options::ReadOptions::default()) .await } pub async fn read_options(&self, path: &str, opts: options::ReadOptions) -> Result<Buffer> { let path = normalize_path(path); Self::read_inner(self.inner().clone(), path, opts).await } pub fn normalize_path(path: &str) -> String { // - all whitespace has been trimmed. // - all leading `/` has been trimmed. let path = path.trim().trim_start_matches('/'); // Fast line for empty path. if path.is_empty() { return "/".to_string(); } let has_trailing = path.ends_with('/'); let mut p = path .split('/') .filter(|v| !v.is_empty()) .collect::<Vec<&str>>() .join("/"); // Append trailing back if input path is endswith `/`. if has_trailing { p.push('/'); } p } ``` ### Are you willing to submit a PR to fix this bug? - [ ] 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-unsubscr...@opendal.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org