From e3b222fc0d1582a4b43748963ff76c44bd4cf20a Mon Sep 17 00:00:00 2001 From: Jonas Kuche Date: Fri, 27 Apr 2018 10:57:10 +0200 Subject: [PATCH] Fix url regex Signed-off-by: Jonas Kuche --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/env_loader.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 487bd99..176ff21 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -727,7 +727,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "zlnk" -version = "0.4.4" +version = "0.4.5" dependencies = [ "dotenv 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "maxminddb 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index ab548a6..ac0febb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "zlnk" -version = "0.4.4" +version = "0.4.5" authors = ["Jonas Kuche "] [dependencies] diff --git a/src/env_loader.rs b/src/env_loader.rs index db462d6..6b43a8e 100644 --- a/src/env_loader.rs +++ b/src/env_loader.rs @@ -14,7 +14,7 @@ pub struct Env { pub disable_stats: bool } -const URL_REGEX: &'static str = r"^(https?://)?([\da-z\.-]+)\.([a-z\.]{2,6})([/\w \.-]*)*/?$"; +const URL_REGEX: &'static str = r"https?://(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)"; pub fn init() -> Env { dotenv().ok();