Skip to content
Snippets Groups Projects
Unverified Commit 9694af82 authored by GyDi's avatar GyDi
Browse files

feat: check the remote profile

parent 28a43869
No related branches found
No related tags found
No related merge requests found
use crate::utils::{dirs, help, tmpl};
use anyhow::{bail, Context, Result};
use serde::{Deserialize, Serialize};
use serde_yaml::Mapping;
use std::fs;
#[derive(Debug, Clone, Deserialize, Serialize)]
......@@ -228,6 +229,11 @@ impl PrfItem {
let name = name.unwrap_or(uid.clone());
let data = resp.text_with_charset("utf-8").await?;
// check the data whether the valid yaml format
if !serde_yaml::from_str::<Mapping>(&data).is_ok() {
bail!("the remote profile data is not valid yaml");
}
Ok(PrfItem {
uid: Some(uid),
itype: Some("remote".into()),
......
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