Improve URL handling (#11)

This commit is contained in:
Adam Cooper 2022-03-22 00:47:02 -04:00
parent 7d00d6f863
commit e77b79afae

View file

@ -153,7 +153,8 @@ async fn get_folder_contents(url_tail: &str, config: &Config) -> Result<String,
async fn publicise_it(path: &str, config: &Config) -> Result<bool, Box<dyn std::error::Error>> { async fn publicise_it(path: &str, config: &Config) -> Result<bool, Box<dyn std::error::Error>> {
debug!("[publicise_it] Entering function..."); debug!("[publicise_it] Entering function...");
let url = "https://cloud.theadamcooper.com/ocs/v2.php/apps/files_sharing/api/v1/shares"; let base_url = Url::parse(config.paths.root.as_str())?;
let url = base_url.join("ocs/v2.php/apps/files_sharing/api/v1/shares")?;
let method = reqwest::Method::POST; let method = reqwest::Method::POST;
let client = reqwest::Client::new(); let client = reqwest::Client::new();
let params = [("path", path), ("shareType", "3")]; let params = [("path", path), ("shareType", "3")];