mirror of
https://github.com/RGBCube/Site
synced 2025-08-01 13:37:49 +00:00
Rename name to path in asset serving
This commit is contained in:
parent
c3d45b6ba4
commit
820b48fa7a
1 changed files with 5 additions and 5 deletions
|
@ -59,14 +59,14 @@ static ASSETS: LazyLock<HashMap<String, Bytes>> = LazyLock::new(|| {
|
|||
assets
|
||||
});
|
||||
|
||||
#[get("/assets/{name}")]
|
||||
pub async fn handler(name: web::Path<String>) -> HttpResponse {
|
||||
let name = name.into_inner();
|
||||
#[get("/assets/{path}")]
|
||||
pub async fn handler(path: web::Path<String>) -> HttpResponse {
|
||||
let path = path.into_inner();
|
||||
|
||||
if let Some(body) = ASSETS.get(&name) {
|
||||
if let Some(body) = ASSETS.get(&path) {
|
||||
HttpResponse::Ok()
|
||||
.content_type(
|
||||
mime_guess::from_path(&name)
|
||||
mime_guess::from_path(&path)
|
||||
.first_or_octet_stream()
|
||||
.essence_str(),
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue