1
0
Fork 0
mirror of https://github.com/SinTan1729/chhoto-url synced 2024-10-16 13:27:03 -05:00

Fixed counting hits

This commit is contained in:
Sayantan Santra 2023-04-03 17:41:52 -05:00
parent 7f6ba5175f
commit 98d10cfd5b

View file

@ -49,9 +49,9 @@ async fn link_handler(shortlink: web::Path<String>) -> impl Responder {
let shortlink_str = shortlink.to_string();
let longlink = utils::get_longurl(shortlink_str);
if longlink == "".to_string() {
database::add_hit(shortlink.as_str());
Redirect::to("/err/404")
} else {
database::add_hit(shortlink.as_str());
Redirect::to(longlink).permanent()
}
}