diff --git a/src/main/java/tk/draganczuk/url/Routes.java b/src/main/java/tk/draganczuk/url/Routes.java index f4477a5..91a780b 100644 --- a/src/main/java/tk/draganczuk/url/Routes.java +++ b/src/main/java/tk/draganczuk/url/Routes.java @@ -29,6 +29,7 @@ public class Routes { split[1] = Utils.randomString(); } String shortUrl = split[1]; + shortUrl = shortUrl.toLowerCase(); if (Utils.validate(shortUrl)) { return urlRepository.addUrl(longUrl, shortUrl); @@ -41,6 +42,7 @@ public class Routes { public static String goToLongUrl(Request req, Response res) { String shortUrl = req.params("shortUrl"); + shortUrl = shortUrl.toLowerCase(); var longUrlOpt = urlRepository .findForShortUrl(shortUrl); diff --git a/src/main/resources/public/index.html b/src/main/resources/public/index.html index 30a8d3e..0e6b942 100644 --- a/src/main/resources/public/index.html +++ b/src/main/resources/public/index.html @@ -31,6 +31,10 @@ line-height: 25px; overflow: scroll; } + + form input[name="shortUrl"] { + text-transform: lowercase; + } @@ -47,7 +51,7 @@
+ pattern="[A-Za-z0-9_-]+" />