path_to_uri

Function path_to_uri 

Source
pub fn path_to_uri(path: &str) -> String
Expand description

Converts a file path to Cloudreve URI format

§Arguments

  • path - File path (can be absolute, relative, or already a URI)

§Returns

A properly formatted Cloudreve URI string

§Examples

use cloudreve_api::api::v4::uri::path_to_uri;

assert_eq!(path_to_uri("/path/to/file.txt"), "cloudreve://my/path/to/file.txt");
assert_eq!(path_to_uri("path/to/file.txt"), "cloudreve://my/path/to/file.txt");
assert_eq!(path_to_uri("cloudreve://my/path/to/file.txt"), "cloudreve://my/path/to/file.txt");