From f72c9d39be3f8f416c3f955c14f2a30c4a18368d Mon Sep 17 00:00:00 2001 From: spikecodes <19519553+spikecodes@users.noreply.github.com> Date: Mon, 25 Jan 2021 17:01:02 -0800 Subject: [PATCH] Simplify proxy --- src/proxy.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/proxy.rs b/src/proxy.rs index bca2b0b..df1ca56 100644 --- a/src/proxy.rs +++ b/src/proxy.rs @@ -21,10 +21,10 @@ pub async fn handler(web::Path(b64): web::Path) -> Result "v.redd.it", ]; - match decode(b64) { - Ok(bytes) => { - let media = String::from_utf8(bytes).unwrap_or_default(); + let decoded = decode(b64).map(|bytes| String::from_utf8(bytes).unwrap_or_default()); + match decoded { + Ok(media) => { match Url::parse(media.as_str()) { Ok(url) => { let domain = url.domain().unwrap_or_default();