File tree Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -253,7 +253,11 @@ pub(crate) async fn rustdoc_redirector_handler(
253
253
. into_response ( ) )
254
254
} else {
255
255
Ok ( axum_cached_redirect (
256
- format ! ( "/crate/{crate_name}/{}" , matched_release. req_version) ,
256
+ EscapedURI :: new (
257
+ & format ! ( "/crate/{crate_name}/{}" , matched_release. req_version) ,
258
+ uri. query ( ) ,
259
+ )
260
+ . as_str ( ) ,
257
261
CachePolicy :: ForeverInCdn ,
258
262
) ?
259
263
. into_response ( ) )
@@ -2983,4 +2987,26 @@ mod test {
2983
2987
Ok ( ( ) )
2984
2988
} )
2985
2989
}
2990
+
2991
+ #[ test_case( true ) ]
2992
+ #[ test_case( false ) ]
2993
+ fn test_redirect_with_query_args ( archive_storage : bool ) {
2994
+ async_wrapper ( |env| async move {
2995
+ env. fake_release ( )
2996
+ . await
2997
+ . name ( "fake" )
2998
+ . version ( "0.0.1" )
2999
+ . archive_storage ( archive_storage)
3000
+ . rustdoc_file ( "fake/index.html" )
3001
+ . binary ( true ) // binary => rustdoc_status = false
3002
+ . create ( )
3003
+ . await ?;
3004
+
3005
+ let web = env. web_app ( ) . await ;
3006
+ web. assert_redirect ( "/fake?a=b" , "/crate/fake/latest?a=b" )
3007
+ . await ?;
3008
+
3009
+ Ok ( ( ) )
3010
+ } ) ;
3011
+ }
2986
3012
}
You can’t perform that action at this time.
0 commit comments