BM header helpers: Add get_url_from_header()

This commit is contained in:
Matthias Beyer 2015-12-28 12:18:16 +01:00
parent 2e7621d2bd
commit 7170f95825
2 changed files with 13 additions and 1 deletions

View file

@ -30,3 +30,7 @@ pub fn get_tags_from_header(header: &FHD) -> Vec<String> {
headerhelpers::tags::data::get_tags_from_header(header) headerhelpers::tags::data::get_tags_from_header(header)
} }
pub fn get_url_from_header(header: &FHD) -> Option<String> {
headerhelpers::data::get_url_from_header(header)
}

View file

@ -19,12 +19,20 @@ pub mod data {
} }
}).and_then(|urlkey| { }).and_then(|urlkey| {
match urlkey.deref().clone() { match urlkey.deref().clone() {
FHD::Key{name: _, value: ref v} => {
match v.deref().clone() {
FHD::Text(s) => Some(s), FHD::Text(s) => Some(s),
_ => { _ => {
warn!("Malformed Header Data: Expected Text, found non-Text"); warn!("Malformed Header Data: Expected Text, found non-Text");
None None
}, },
} }
}
_ => {
warn!("Malformed Header Data: Expected Text, found non-Text");
None
},
}
}) })
}, },
_ => { _ => {