mirror of
https://github.com/valmojr/armatak.git
synced 2026-08-19 08:22:56 +00:00
Added extension piece of code for handling the mavlink mocker
This commit is contained in:
+2
-15
@@ -1,3 +1,4 @@
|
||||
use super::video::video_detail_xml;
|
||||
use chrono::{Duration, SecondsFormat, Utc};
|
||||
use uuid::Uuid;
|
||||
|
||||
@@ -20,14 +21,6 @@ pub struct CursorOverTime {
|
||||
}
|
||||
|
||||
impl CursorOverTime {
|
||||
fn escape_xml_attribute(value: &str) -> String {
|
||||
value
|
||||
.replace('&', "&")
|
||||
.replace('"', """)
|
||||
.replace('<', "<")
|
||||
.replace('>', ">")
|
||||
}
|
||||
|
||||
pub fn convert_to_xml(&self) -> String {
|
||||
let uuid = match &self.uuid {
|
||||
Some(uuid) => uuid,
|
||||
@@ -118,13 +111,7 @@ impl CursorOverTime {
|
||||
|
||||
if let Some(video_url) = &self.video_url {
|
||||
if !video_url.trim().is_empty() {
|
||||
xml.push_str(
|
||||
format!(
|
||||
"<__video url=\"{}\" />",
|
||||
Self::escape_xml_attribute(video_url.trim())
|
||||
)
|
||||
.as_str(),
|
||||
);
|
||||
xml.push_str(&video_detail_xml(video_url, uuid, &self.contact_callsign));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user