From 151f691609bb5d9cb9b5e04866f9dfcb2660a8eb Mon Sep 17 00:00:00 2001 From: Anirudh Rowjee Date: Sat, 2 Oct 2021 15:24:04 +0530 Subject: [PATCH 1/2] Fixes #1750 This commit is a fix to issue #1750. As a part of the changes to solve this issue, the following changes have been made - 1. Route registration for static assets has been modified 2. the `mut` keyword on the `scope` has been removed. --- meilisearch-http/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meilisearch-http/src/lib.rs b/meilisearch-http/src/lib.rs index 219e8b1c8..492e500b9 100644 --- a/meilisearch-http/src/lib.rs +++ b/meilisearch-http/src/lib.rs @@ -147,7 +147,7 @@ pub fn dashboard(config: &mut web::ServiceConfig, enable_frontend: bool) { if enable_frontend { let generated = generated::generate(); - let mut scope = web::scope("/"); + let scope = web::scope("/"); // Generate routes for mini-dashboard assets for (path, resource) in generated.into_iter() { let Resource { @@ -159,7 +159,7 @@ pub fn dashboard(config: &mut web::ServiceConfig, enable_frontend: bool) { web::get().to(move || HttpResponse::Ok().content_type(mime_type).body(data)), )); } else { - scope = scope.service(web::resource(path).route( + config.service(web::resource(path).route( web::get().to(move || HttpResponse::Ok().content_type(mime_type).body(data)), )); } From bffab21b101b1f853b3be8c06b2de93d51608357 Mon Sep 17 00:00:00 2001 From: Anirudh Rowjee Date: Mon, 4 Oct 2021 14:47:05 +0530 Subject: [PATCH 2/2] Changes 1. Removed redundant scope registration --- meilisearch-http/src/lib.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/meilisearch-http/src/lib.rs b/meilisearch-http/src/lib.rs index 492e500b9..0b9dacbe0 100644 --- a/meilisearch-http/src/lib.rs +++ b/meilisearch-http/src/lib.rs @@ -147,7 +147,6 @@ pub fn dashboard(config: &mut web::ServiceConfig, enable_frontend: bool) { if enable_frontend { let generated = generated::generate(); - let scope = web::scope("/"); // Generate routes for mini-dashboard assets for (path, resource) in generated.into_iter() { let Resource { @@ -164,7 +163,6 @@ pub fn dashboard(config: &mut web::ServiceConfig, enable_frontend: bool) { )); } } - config.service(scope); } else { config.service(web::resource("/").route(web::get().to(routes::running))); }