Skip to main content

uri_to_decoded_path

Function uri_to_decoded_path 

Source
pub fn uri_to_decoded_path(uri: &str) -> Result<String, String>
Expand description

Extracts the path from a Cloudreve URI and percent-decodes it

URIs carry their path segments encoded, so uri_to_path on its own hands back things like /photos/Screenshot%20-%20%E5%89%AF%E6%9C%AC.png. Use this whenever the path is headed for display or for an API expecting a plain path.

ยงExamples

use cloudreve_api::api::v4::uri::uri_to_decoded_path;

assert_eq!(
    uri_to_decoded_path("cloudreve://my/docs/a%20b.txt").unwrap(),
    "/docs/a b.txt"
);