mirror of
https://github.com/minoplhy/chhoto-url.git
synced 2024-11-22 09:16:46 +00:00
fix: Wrong regex in validate_link, fixes #6
This commit is contained in:
parent
a32f00c36e
commit
0bfaa49e7b
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user