@@ -4,7 +4,6 @@ use crate::config::{ServerConfig, ServiceConfig};
44use crate :: xrpc_server:: types:: { HandlerPipeThrough , InvalidRequestError , XRPCError } ;
55use crate :: { context, SharedIdResolver , APP_USER_AGENT } ;
66use anyhow:: { bail, Result } ;
7- use futures:: StreamExt ;
87use lazy_static:: lazy_static;
98use reqwest:: header:: { HeaderMap , HeaderValue , CONTENT_TYPE } ;
109use reqwest:: { Client , RequestBuilder , Response } ;
@@ -13,7 +12,6 @@ use rocket::http::{Method, Status};
1312use rocket:: request:: { FromRequest , Outcome , Request } ;
1413use rocket:: { Data , State } ;
1514use rsky_common:: { get_service_endpoint, GetServiceEndpointOpts } ;
16- use rsky_identity:: types:: DidDocument ;
1715use rsky_repo:: types:: Ids ;
1816use serde:: de:: DeserializeOwned ;
1917use serde_json:: Value as JsonValue ;
@@ -193,18 +191,17 @@ pub async fn pipethrough_procedure_post<'r>(
193191 let encoded_body: Option < JsonValue > ;
194192 match body {
195193 None => encoded_body = None ,
196- Some ( mut body) => {
197- let res;
198- match body. open ( 50 . megabytes ( ) ) . into_string ( ) . await {
194+ Some ( body) => {
195+ let res = match body. open ( 50 . megabytes ( ) ) . into_string ( ) . await {
199196 Ok ( res1) => {
200197 tracing:: info!( res1. value) ;
201- res = res1. value ;
198+ res1. value
202199 }
203200 Err ( error) => {
204201 tracing:: error!( "{error}" ) ;
205202 return Err ( ApiError :: RuntimeError ) ;
206203 }
207- }
204+ } ;
208205 match serde_json:: from_str ( res. as_str ( ) ) {
209206 Ok ( res) => {
210207 encoded_body = Some ( res) ;
@@ -589,7 +586,7 @@ pub fn is_safe_url(url: Url) -> bool {
589586 if url. scheme ( ) != "https" {
590587 return false ;
591588 }
592- return match url. host_str ( ) {
589+ match url. host_str ( ) {
593590 None => false ,
594591 Some ( hostname) if hostname == "localhost" => false ,
595592 Some ( hostname) => {
@@ -598,21 +595,5 @@ pub fn is_safe_url(url: Url) -> bool {
598595 }
599596 true
600597 }
601- } ;
602- }
603-
604- #[ cfg( test) ]
605- mod tests {
606- use super :: * ;
607-
608- #[ test]
609- fn test_parse_atproto_proxy_header ( ) {
610- // let text = "#blacksky? more like #niggersky";
611- // let result = contains_explicit_slurs(text);
612- // assert_eq!(
613- // result, true,
614- // "Provided text should be flagged, actual: {}",
615- // result
616- // );
617598 }
618599}
0 commit comments