@@ -28,7 +28,6 @@ use sqlx::Row;
2828use std:: collections:: { BTreeMap , HashMap , HashSet } ;
2929use std:: str;
3030use std:: sync:: Arc ;
31- use tracing:: warn;
3231use url:: form_urlencoded;
3332
3433use super :: cache:: CachePolicy ;
@@ -534,6 +533,7 @@ pub(crate) async fn search_handler(
534533 . into_response ( ) ) ;
535534 }
536535
536+ // Capture query results into a BTreeMap data structure
537537 let mut queries = BTreeMap :: new ( ) ;
538538
539539 let krate = match query. split_once ( "::" ) {
@@ -577,10 +577,9 @@ pub(crate) async fn search_handler(
577577 }
578578
579579 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 ) ?;
584583 let query_params = String :: from_utf8_lossy ( & decoded) ;
585584 let query_params = query_params. strip_prefix ( '?' ) . ok_or_else ( || {
586585 // sometimes we see plain bytes being passed to `paginate`.
@@ -589,7 +588,6 @@ pub(crate) async fn search_handler(
589588 // The whole point of the `paginate` design is that we don't
590589 // know anything about the pagination args and crates.io can
591590 // 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}\" " ) ;
593591 AxumNope :: NoResults
594592 } ) ?;
595593
@@ -601,15 +599,19 @@ pub(crate) async fn search_handler(
601599 }
602600 }
603601
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 ) ?
605605 } else if !query. is_empty ( ) {
606606 let query_params: String = form_urlencoded:: Serializer :: new ( String :: new ( ) )
607607 . append_pair ( "q" , & query)
608608 . append_pair ( "sort" , & sort_by)
609609 . append_pair ( "per_page" , & RELEASES_IN_RELEASES . to_string ( ) )
610610 . finish ( ) ;
611611
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 ) ?
613615 } else {
614616 return Err ( AxumNope :: NoResults ) ;
615617 } ;
0 commit comments