use axum::Json; use axum::extract::{Path, State}; use axum::http::HeaderValue; use axum::http::header; use axum::response::{IntoResponse, Response}; use jwt::extractor::AuthUser; use uuid::Uuid; use crate::error::RepoResult; use crate::features::RepoService; #[utoipa::path( get, path = "/repo/{channel_id}/{repo_id}/raw/{filepath:path}", tag = "repo", responses((status = 200, description = "Get raw file content", content_type = "application/octet-stream")), security(("bearer_auth" = [])) )] pub(crate) async fn handler( State(svc): State, AuthUser { claims }: AuthUser, Path((_, repo_id, path)): Path<(Uuid, Uuid, String)>, ) -> RepoResult { let bytes = svc.get_raw_file(claims.sub, repo_id, &path, None).await?; let resp = ( [( header::CONTENT_TYPE, HeaderValue::from_static("application/octet-stream"), )], bytes, ) .into_response(); Ok(resp) }