Made proxy not panic when not passing query

This commit is contained in:
Jef Roosens 2021-11-26 13:22:22 +01:00
parent b442e352b3
commit da2d31a838
Signed by: Jef Roosens
GPG key ID: B580B976584B5F30

View file

@ -94,12 +94,18 @@ impl Handler for ProxyServer
// We first extract all URL segments starting from the mountpoint // We first extract all URL segments starting from the mountpoint
let segments: PathBuf = req.segments(0..).unwrap(); let segments: PathBuf = req.segments(0..).unwrap();
let query_part = if let Some(query) = req.uri().query() {
format!("?{}", query)
}else{
String::from("")
};
let url = format!( let url = format!(
"{}{}/{}?{}", "{}{}/{}{}",
self.root, self.root,
self.prefix.to_str().unwrap(), self.prefix.to_str().unwrap(),
segments.to_str().unwrap(), segments.to_str().unwrap(),
req.uri().query().unwrap() query_part
); );
// And finally, the data // And finally, the data