@@ -28,7 +28,6 @@ use sqlx::Row;
28
28
use std:: collections:: { BTreeMap , HashMap , HashSet } ;
29
29
use std:: str;
30
30
use std:: sync:: Arc ;
31
- use tracing:: warn;
32
31
use url:: form_urlencoded;
33
32
34
33
use super :: cache:: CachePolicy ;
@@ -534,6 +533,7 @@ pub(crate) async fn search_handler(
534
533
. into_response ( ) ) ;
535
534
}
536
535
536
+ // Capture query results into a BTreeMap data structure
537
537
let mut queries = BTreeMap :: new ( ) ;
538
538
539
539
let krate = match query. split_once ( "::" ) {
@@ -577,10 +577,9 @@ pub(crate) async fn search_handler(
577
577
}
578
578
579
579
let search_result = if let Some ( paginate) = params. get ( "paginate" ) {
580
- let decoded = b64. decode ( paginate. as_bytes ( ) ) . map_err ( |e| {
581
- warn ! ( "error when decoding pagination base64 string \" {paginate}\" : {e:?}" ) ;
582
- AxumNope :: NoResults
583
- } ) ?;
580
+ let decoded = b64
581
+ . decode ( paginate. as_bytes ( ) )
582
+ . map_err ( |_| AxumNope :: NoResults ) ?;
584
583
let query_params = String :: from_utf8_lossy ( & decoded) ;
585
584
let query_params = query_params. strip_prefix ( '?' ) . ok_or_else ( || {
586
585
// sometimes we see plain bytes being passed to `paginate`.
@@ -589,7 +588,6 @@ pub(crate) async fn search_handler(
589
588
// The whole point of the `paginate` design is that we don't
590
589
// know anything about the pagination args and crates.io can
591
590
// change them as they wish, so we cannot do any more checks here.
592
- warn ! ( "didn't get query args in `paginate` arguments for search: \" {query_params}\" " ) ;
593
591
AxumNope :: NoResults
594
592
} ) ?;
595
593
@@ -601,15 +599,19 @@ pub(crate) async fn search_handler(
601
599
}
602
600
}
603
601
604
- get_search_results ( & mut conn, & registry, query_params) . await ?
602
+ get_search_results ( & mut conn, & registry, query_params)
603
+ . await
604
+ . map_err ( |_| AxumNope :: NoResults ) ?
605
605
} else if !query. is_empty ( ) {
606
606
let query_params: String = form_urlencoded:: Serializer :: new ( String :: new ( ) )
607
607
. append_pair ( "q" , & query)
608
608
. append_pair ( "sort" , & sort_by)
609
609
. append_pair ( "per_page" , & RELEASES_IN_RELEASES . to_string ( ) )
610
610
. finish ( ) ;
611
611
612
- get_search_results ( & mut conn, & registry, & query_params) . await ?
612
+ get_search_results ( & mut conn, & registry, & query_params)
613
+ . await
614
+ . map_err ( |_| AxumNope :: NoResults ) ?
613
615
} else {
614
616
return Err ( AxumNope :: NoResults ) ;
615
617
} ;
0 commit comments