opensession_core/
git_storage.rs1pub fn generate_raw_url(remote_url: &str, rel_path: &str) -> String {
3 let normalized = remote_url
5 .trim_end_matches(".git")
6 .replace("git@github.com:", "https://github.com/")
7 .replace("git@gitlab.com:", "https://gitlab.com/");
8
9 if normalized.contains("github.com") {
10 let path = normalized.trim_start_matches("https://github.com/");
12 format!(
13 "https://raw.githubusercontent.com/{}/opensession/{}",
14 path, rel_path
15 )
16 } else if normalized.contains("gitlab.com") {
17 let path = normalized.trim_start_matches("https://gitlab.com/");
19 format!("https://gitlab.com/{}/-/raw/opensession/{}", path, rel_path)
20 } else {
21 format!("{}/raw/opensession/{}", normalized, rel_path)
23 }
24}