Commit

Author:

Hash:

Timestamp:

+0 -28 +/-1 browse

Kevin Schoon [me@kevinschoon.com]

0dfe799861cd68fd55a33a36fb2ccc8266994dd5

Sat, 30 Dec 2023 17:14:26 +0000 (1.5 years ago)

rm unused code
1diff --git a/src/web2/util.rs b/src/web2/util.rs
2index 00ae1a1..59de08c 100644
3--- a/src/web2/util.rs
4+++ b/src/web2/util.rs
5 @@ -1,10 +1,8 @@
6- use std::collections::HashMap;
7 use std::path::PathBuf;
8
9 use axum::http::Uri;
10 use url::Url;
11
12- use crate::config::Collection;
13
14 // select a segment of the path from the given url between start and end.
15 // e.g.
16 @@ -50,32 +48,6 @@ pub fn project_url(uri: &Uri, origin: &str) -> String {
17 url.to_string()
18 }
19
20- pub fn repo_path(uri: &Uri, collections: Vec<Collection>) -> Option<PathBuf> {
21- let mut cm = HashMap::new();
22- for collection in collections.iter() {
23- cm.insert(collection.name.clone(), collection.path.clone());
24- }
25- let base = select_path(uri, Some(0), Some(1));
26- match base {
27- Some(base) => match base.iter().count() {
28- 0 => unreachable!("invalid path"),
29- 1 => unreachable!("invalid path"),
30- _ => {
31- let base = base.strip_prefix("/").unwrap();
32- let mut components = base.components();
33- let (collection, repo_name) = (
34- components.next().unwrap().as_os_str().to_str().unwrap(),
35- components.next().unwrap().as_os_str().to_str().unwrap(),
36- );
37- cm.get(collection).map(|collection_path| {
38- PathBuf::from_iter([collection_path.as_str(), repo_name])
39- })
40- }
41- },
42- None => None,
43- }
44- }
45-
46 /// construct an LFS url based on the template
47 pub fn lfs_url(template: &str, collection: &str, name: &str, oid: &str) -> String {
48 let url = template.to_string();