mirror of
https://github.com/RGBCube/Site
synced 2025-08-02 05:57:46 +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
|
assets
|
||||||
});
|
});
|
||||||
|
|
||||||
#[get("/assets/{name}")]
|
#[get("/assets/{path}")]
|
||||||
pub async fn handler(name: web::Path<String>) -> HttpResponse {
|
pub async fn handler(path: web::Path<String>) -> HttpResponse {
|
||||||
let name = name.into_inner();
|
let path = path.into_inner();
|
||||||
|
|
||||||
if let Some(body) = ASSETS.get(&name) {
|
if let Some(body) = ASSETS.get(&path) {
|
||||||
HttpResponse::Ok()
|
HttpResponse::Ok()
|
||||||
.content_type(
|
.content_type(
|
||||||
mime_guess::from_path(&name)
|
mime_guess::from_path(&path)
|
||||||
.first_or_octet_stream()
|
.first_or_octet_stream()
|
||||||
.essence_str(),
|
.essence_str(),
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue