mirror of
https://github.com/minoplhy/chhoto-url.git
synced 2024-11-23 01:26:46 +00:00
Auto convert shortlinks to lower case
This commit is contained in:
parent
01930f6d62
commit
0740bc79aa
@ -29,6 +29,7 @@ public class Routes {
|
|||||||
split[1] = Utils.randomString();
|
split[1] = Utils.randomString();
|
||||||
}
|
}
|
||||||
String shortUrl = split[1];
|
String shortUrl = split[1];
|
||||||
|
shortUrl = shortUrl.toLowerCase();
|
||||||
|
|
||||||
if (Utils.validate(shortUrl)) {
|
if (Utils.validate(shortUrl)) {
|
||||||
return urlRepository.addUrl(longUrl, shortUrl);
|
return urlRepository.addUrl(longUrl, shortUrl);
|
||||||
@ -41,6 +42,7 @@ public class Routes {
|
|||||||
|
|
||||||
public static String goToLongUrl(Request req, Response res) {
|
public static String goToLongUrl(Request req, Response res) {
|
||||||
String shortUrl = req.params("shortUrl");
|
String shortUrl = req.params("shortUrl");
|
||||||
|
shortUrl = shortUrl.toLowerCase();
|
||||||
var longUrlOpt = urlRepository
|
var longUrlOpt = urlRepository
|
||||||
.findForShortUrl(shortUrl);
|
.findForShortUrl(shortUrl);
|
||||||
|
|
||||||
|
@ -31,6 +31,10 @@
|
|||||||
line-height: 25px;
|
line-height: 25px;
|
||||||
overflow: scroll;
|
overflow: scroll;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
form input[name="shortUrl"] {
|
||||||
|
text-transform: lowercase;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
@ -47,7 +51,7 @@
|
|||||||
<div class="pure-control-group">
|
<div class="pure-control-group">
|
||||||
<label for="shortUrl">Short URL (Optional)</label>
|
<label for="shortUrl">Short URL (Optional)</label>
|
||||||
<input type="text" name="shortUrl" id="shortUrl" placeholder="Only a-z, 0-9, - and _ are allowed"
|
<input type="text" name="shortUrl" id="shortUrl" placeholder="Only a-z, 0-9, - and _ are allowed"
|
||||||
pattern="[a-z0-9_-]+" />
|
pattern="[A-Za-z0-9_-]+" />
|
||||||
</div>
|
</div>
|
||||||
<div class="pure-controls">
|
<div class="pure-controls">
|
||||||
<button class="pure-button pure-button-primary">Submit</button>
|
<button class="pure-button pure-button-primary">Submit</button>
|
||||||
|
Loading…
Reference in New Issue
Block a user