File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -475,7 +475,11 @@ fn req_path(req: &ServiceRequest) -> Cow<'_, str> {
475475
476476fn redirect_missing_trailing_slash ( uri : & Uri ) -> Option < HttpResponse > {
477477 let path = uri. path ( ) ;
478- if !path. ends_with ( '/' ) && !path. ends_with ( ".sql" ) {
478+ if !path. ends_with ( '/' )
479+ && !path
480+ . rsplit_once ( '.' )
481+ . is_some_and ( |( _, ext) | ext. eq_ignore_ascii_case ( "sql" ) )
482+ {
479483 let mut redirect_path = path. to_owned ( ) ;
480484 redirect_path. push ( '/' ) ;
481485 if let Some ( query) = uri. query ( ) {
@@ -485,8 +489,7 @@ fn redirect_missing_trailing_slash(uri: &Uri) -> Option<HttpResponse> {
485489 Some (
486490 HttpResponse :: MovedPermanently ( )
487491 . insert_header ( ( header:: LOCATION , redirect_path) )
488- . finish ( )
489- . into ( ) ,
492+ . finish ( ) ,
490493 )
491494 } else {
492495 None
You can’t perform that action at this time.
0 commit comments