fix url decoding in /uploaded endpoint
This commit is contained in:
parent
dc2f7ecab0
commit
b9849153f0
|
@ -140,15 +140,17 @@ fn get_file_url(req: &HttpRequest, id: &str, name: Option<&str>) -> String {
|
|||
}
|
||||
}
|
||||
|
||||
pub async fn uploaded(req: HttpRequest) -> Result<HttpResponse, Error> {
|
||||
let id = req.match_info().query("id");
|
||||
let name = req.match_info().get("name");
|
||||
pub async fn uploaded(
|
||||
req: HttpRequest,
|
||||
path: web::Path<(String, Option<String>)>,
|
||||
) -> Result<HttpResponse, Error> {
|
||||
let (id, name) = path.into_inner();
|
||||
let upload_html = if name.is_some() {
|
||||
UPLOAD_SHORT_HTML
|
||||
.replace("{link}", &get_file_url(&req, id, name))
|
||||
.replace("{shortlink}", &get_file_url(&req, id, None))
|
||||
.replace("{link}", &get_file_url(&req, &id, name.as_deref()))
|
||||
.replace("{shortlink}", &get_file_url(&req, &id, None))
|
||||
} else {
|
||||
UPLOAD_HTML.replace("{link}", &get_file_url(&req, id, name))
|
||||
UPLOAD_HTML.replace("{link}", &get_file_url(&req, &id, name.as_deref()))
|
||||
};
|
||||
Ok(HttpResponse::Ok()
|
||||
.content_type("text/html")
|
||||
|
|
Loading…
Reference in New Issue