m/cup
1
0
mirror of https://github.com/sergi0g/cup.git synced 2025-11-17 09:33:38 -05:00
Files
cup/src/utils/link.rs
Sergio 0f9c5d1466 V3
Many many many changes, honestly just read the release notes
2025-02-28 20:43:49 +02:00

14 lines
324 B
Rust

use std::str::FromStr;
use http_link::parse_link_header;
use reqwest::Url;
use crate::error;
pub fn parse_link(link: &str, base: &str) -> String {
match parse_link_header(link, &Url::from_str(base).unwrap()) {
Ok(l) => l[0].target.to_string(),
Err(e) => error!("Failed to parse link! {}", e),
}
}