1
0
Fork 0
mirror of https://github.com/SinTan1729/chhoto-url synced 2024-12-26 07:38:36 -06:00

fix: Wrong regex in validate_link, fixes #6

This commit is contained in:
Sayantan Santra 2024-03-10 18:18:07 -05:00
parent a32f00c36e
commit 0bfaa49e7b
Signed by: SinTan1729
GPG key ID: EB3E68BFBA25C85F

View file

@ -12,7 +12,7 @@ pub fn get_longurl(shortlink: String, db: &Connection) -> String {
}
fn validate_link(link: &str) -> bool {
let re = Regex::new("[a-z0-9-_]+").unwrap();
let re = Regex::new("^[a-z0-9-_]+$").unwrap();
re.is_match(link)
}