~/selfhut

selfhut/src/repository/raw.rs -rw-r--r-- 375 B
0016c2cc — arthurmelton clippy 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,
        branch,
        location.get().display().to_string(),
    ) {
        Some(file) => Some(file.2),
        None => None,
    }
}