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 Component; 9 10use ; 11use header; 12use IntoResponse; 13use Deserialize; 14 15use crate; 16use crate; 17 18/// Path parameters for the raw file route. 19 20pub 24 25/// Serves the raw contents of a file at `{sha}:{path}` in the given repository 26/// with an appropriate `Content-Type` header. 27pub async 58 59/// Returns a `Content-Type` string based on the file extension of `path`. 60/// Falls back to `application/octet-stream` for unknown extensions. 61