Simplify proxy

This commit is contained in:
spikecodes 2021-01-25 17:01:02 -08:00
parent e6c2d08425
commit f72c9d39be

View File

@ -21,10 +21,10 @@ pub async fn handler(web::Path(b64): web::Path<String>) -> Result<HttpResponse>
"v.redd.it", "v.redd.it",
]; ];
match decode(b64) { let decoded = decode(b64).map(|bytes| String::from_utf8(bytes).unwrap_or_default());
Ok(bytes) => {
let media = String::from_utf8(bytes).unwrap_or_default();
match decoded {
Ok(media) => {
match Url::parse(media.as_str()) { match Url::parse(media.as_str()) {
Ok(url) => { Ok(url) => {
let domain = url.domain().unwrap_or_default(); let domain = url.domain().unwrap_or_default();