From 0bfaa49e7b9479e562095d17bc5dbdc7964d63cb Mon Sep 17 00:00:00 2001 From: SinTan1729 Date: Sun, 10 Mar 2024 18:18:07 -0500 Subject: [PATCH] fix: Wrong regex in validate_link, fixes #6 --- actix/src/utils.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/actix/src/utils.rs b/actix/src/utils.rs index f783d24..248cd9a 100644 --- a/actix/src/utils.rs +++ b/actix/src/utils.rs @@ -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) }