diff options
author | Sven-Hendrik Haase <svenstaro@gmail.com> | 2025-02-06 06:13:11 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-06 06:13:11 +0000 |
commit | e5a877f28f3f9d88704a590f2dc7fcd07e09a1d5 (patch) | |
tree | 01a9bc644ffaf4dd6df455430d4546dfc568d998 | |
parent | Strip symlink target dir to make Windows happy (diff) | |
parent | move favicon and css to stable, non-random routes (diff) | |
download | miniserve-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.rs | 8 | ||||
-rw-r--r-- | tests/serve_request.rs | 6 |
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, |