fix: Wrong regex in validate_link, fixes #6

This commit is contained in:
SinTan1729 2024-03-10 18:18:07 -05:00
parent a32f00c36e
commit 0bfaa49e7b
No known key found for this signature in database
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 { 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) re.is_match(link)
} }