~/selfhut

selfhut/src/repository/raw.rs -rw-r--r-- 391 B
00c0a257 — Arthur Melton format code 2 years ago
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use crate::git::file::file;
use crate::PathBufWithDotfiles;

#[get("/<repo>/blob/<branch>/<location..>", rank = 2)]
pub fn raw(repo: String, branch: String, location: PathBufWithDotfiles) -> Option<Vec<u8>> {
    match file(
        repo.clone(),
        branch.clone(),
        location.get().display().to_string(),
    ) {
        Some(file) => Some(file.2),
        None => None,
    }
}