aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven-Hendrik Haase <svenstaro@gmail.com>2025-02-06 06:13:11 +0000
committerGitHub <noreply@github.com>2025-02-06 06:13:11 +0000
commite5a877f28f3f9d88704a590f2dc7fcd07e09a1d5 (patch)
tree01a9bc644ffaf4dd6df455430d4546dfc568d998
parentStrip symlink target dir to make Windows happy (diff)
parentmove favicon and css to stable, non-random routes (diff)
downloadminiserve-e5a877f28f3f9d88704a590f2dc7fcd07e09a1d5.tar.gz
miniserve-e5a877f28f3f9d88704a590f2dc7fcd07e09a1d5.zip
Merge pull request #1472 from ahti/asset-paths
move favicon and css to stable, non-random routes
-rw-r--r--src/config.rs8
-rw-r--r--tests/serve_request.rs6
2 files changed, 7 insertions, 7 deletions
diff --git a/src/config.rs b/src/config.rs
index 5d2d7e8..953bba1 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -196,13 +196,13 @@ impl MiniserveConfig {
// Otherwise, we should apply route_prefix to static files.
let (favicon_route, css_route) = if args.random_route {
(
- format!("/{}", nanoid::nanoid!(10, &ROUTE_ALPHABET)),
- format!("/{}", nanoid::nanoid!(10, &ROUTE_ALPHABET)),
+ "/__miniserve_internal/favicon.svg".into(),
+ "/__miniserve_internal/style.css".into(),
)
} else {
(
- format!("{}/{}", route_prefix, nanoid::nanoid!(10, &ROUTE_ALPHABET)),
- format!("{}/{}", route_prefix, nanoid::nanoid!(10, &ROUTE_ALPHABET)),
+ format!("{}/{}", route_prefix, "__miniserve_internal/favicon.ico"),
+ format!("{}/{}", route_prefix, "__miniserve_internal/style.css"),
)
};
diff --git a/tests/serve_request.rs b/tests/serve_request.rs
index a53abf9..f840efd 100644
--- a/tests/serve_request.rs
+++ b/tests/serve_request.rs
@@ -290,9 +290,9 @@ fn serves_requests_with_route_prefix(#[case] server: TestServer) -> Result<(), E
}
#[rstest]
-#[case(server(&[] as &[&str]), "/[a-f0-9]+")]
-#[case(server(&["--random-route"]), "/[a-f0-9]+")]
-#[case(server(&["--route-prefix", "foobar"]), "/foobar/[a-f0-9]+")]
+#[case(server(&[] as &[&str]), "/__miniserve_internal/[a-z.]+")]
+#[case(server(&["--random-route"]), "/__miniserve_internal/[a-z.]+")]
+#[case(server(&["--route-prefix", "foobar"]), "/foobar/__miniserve_internal/[a-z.]+")]
fn serves_requests_static_file_check(
#[case] server: TestServer,
#[case] static_file_pattern: String,