Skip to content
Snippets Groups Projects
Unverified Commit c046a199 authored by GyDi's avatar GyDi Committed by GitHub
Browse files

fix: fetch profile panic

parent f709117c
No related branches found
No related tags found
No related merge requests found
......@@ -54,20 +54,20 @@ pub async fn fetch_profile(url: &str, with_proxy: bool) -> Option<ProfileRespons
}
};
// parse the `name` and `file`
let (name, file) = {
let file = {
let now = SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap()
.as_secs();
let file = format!("{}.yaml", now);
let name = header.get("Content-Disposition").unwrap().to_str().unwrap();
let name = parse_string::<String>(name, "filename=");
format!("{}.yaml", now)
};
match name {
Some(f) => (f, file),
None => (file.clone(), file),
let name = match header.get("Content-Disposition") {
Some(name) => {
let name = name.to_str().unwrap();
parse_string::<String>(name, "filename=").unwrap_or(file.clone())
}
None => file.clone(),
};
// get the data
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment