Use base64::Engine instead of base64::decode
Signed-off-by: baalajimaestro <me@baalajimaestro.me>
This commit is contained in:
parent
4f2c282695
commit
3c8aee3c09
1 changed files with 2 additions and 2 deletions
|
@ -8,6 +8,7 @@ use actix_web::{
|
||||||
use mime::TEXT_HTML;
|
use mime::TEXT_HTML;
|
||||||
use reqwest::{header::HeaderMap, Client};
|
use reqwest::{header::HeaderMap, Client};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
use base64::{Engine, engine::general_purpose};
|
||||||
use std::env;
|
use std::env;
|
||||||
use tera::{Context, Tera};
|
use tera::{Context, Tera};
|
||||||
|
|
||||||
|
@ -53,8 +54,7 @@ async fn paste_render(data: Data<Template>, paste: Query<Paste>) -> impl Respond
|
||||||
paste_content = "Paste ID Invalid".to_string();
|
paste_content = "Paste ID Invalid".to_string();
|
||||||
} else {
|
} else {
|
||||||
let resp_struct: ResponseJSON = serde_json::from_str(&response_json).unwrap();
|
let resp_struct: ResponseJSON = serde_json::from_str(&response_json).unwrap();
|
||||||
paste_content =
|
paste_content = String::from_utf8(general_purpose::STANDARD.decode(resp_struct.content).unwrap()).unwrap();
|
||||||
String::from_utf8(base64::decode(resp_struct.content).unwrap()).unwrap();
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
paste_content = "Provide a Paste ID".to_string();
|
paste_content = "Provide a Paste ID".to_string();
|
||||||
|
|
Loading…
Reference in a new issue