From 81fc707d27bc1e73f752369095618499b26853a7 Mon Sep 17 00:00:00 2001 From: SinTan1729 Date: Sat, 5 Nov 2022 19:18:04 -0500 Subject: [PATCH] Change invalid shorturl error message --- src/main/java/tk/draganczuk/url/Routes.java | 2 +- src/main/java/tk/draganczuk/url/Utils.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/tk/draganczuk/url/Routes.java b/src/main/java/tk/draganczuk/url/Routes.java index 5ce2c2d..f4477a5 100644 --- a/src/main/java/tk/draganczuk/url/Routes.java +++ b/src/main/java/tk/draganczuk/url/Routes.java @@ -34,7 +34,7 @@ public class Routes { return urlRepository.addUrl(longUrl, shortUrl); } else { res.status(HttpStatus.BAD_REQUEST_400); - return "shortUrl not valid ([a-z0-9]+)"; + return "shortUrl not valid ([a-z0-9-_]+)"; } } diff --git a/src/main/java/tk/draganczuk/url/Utils.java b/src/main/java/tk/draganczuk/url/Utils.java index 14e71d4..8410e5a 100644 --- a/src/main/java/tk/draganczuk/url/Utils.java +++ b/src/main/java/tk/draganczuk/url/Utils.java @@ -6,7 +6,7 @@ import java.util.regex.Pattern; public class Utils { private static final Random random = new Random(System.currentTimeMillis()); - private static final String SHORT_URL_PATTERN = "[a-z0-9_-]+"; + private static final String SHORT_URL_PATTERN = "[a-z0-9-_]+"; private static final Pattern PATTERN = Pattern.compile(SHORT_URL_PATTERN); public static String randomString() {