Parent
[>]
1//! Route handler for serving raw file contents from a git repository. 2//! 3//! Covers one route: `/{repo}/commits/{sha}/raw/{*path}`. The handler resolves 4//! the rev-spec `{sha}:{path}` via `gix`, validates the path against directory 5//! traversal, and serves the blob bytes with an appropriate `Content-Type` 6//! header derived from the file extension. 7 8use ; 9use header; 10use IntoResponse; 11use Deserialize; 12 13use crate; 14use crate; 15use crate; 16 17/// Path parameters for the raw file route. 18 19pub 23 24/// Serves the raw contents of a file at `{sha}:{path}` in the given repository 25/// with an appropriate `Content-Type` header. 26pub async 56 57/// Returns a `Content-Type` string based on the file extension of `path`. 58/// Falls back to `application/octet-stream` for unknown extensions. 59 71 72 73