mirror of
https://github.com/minoplhy/chhoto-url.git
synced 2024-11-22 09:16:46 +00:00
Fixed counting hits
This commit is contained in:
parent
7f6ba5175f
commit
98d10cfd5b
@ -49,9 +49,9 @@ async fn link_handler(shortlink: web::Path<String>) -> impl Responder {
|
|||||||
let shortlink_str = shortlink.to_string();
|
let shortlink_str = shortlink.to_string();
|
||||||
let longlink = utils::get_longurl(shortlink_str);
|
let longlink = utils::get_longurl(shortlink_str);
|
||||||
if longlink == "".to_string() {
|
if longlink == "".to_string() {
|
||||||
database::add_hit(shortlink.as_str());
|
|
||||||
Redirect::to("/err/404")
|
Redirect::to("/err/404")
|
||||||
} else {
|
} else {
|
||||||
|
database::add_hit(shortlink.as_str());
|
||||||
Redirect::to(longlink).permanent()
|
Redirect::to(longlink).permanent()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user