1
0
Fork 0
mirror of https://github.com/SinTan1729/chhoto-url synced 2024-12-26 23:58:35 -06:00

Change invalid shorturl error message

This commit is contained in:
Sayantan Santra 2022-11-05 19:18:04 -05:00
parent 0ef85242ec
commit 81fc707d27
2 changed files with 2 additions and 2 deletions

View file

@ -34,7 +34,7 @@ public class Routes {
return urlRepository.addUrl(longUrl, shortUrl); return urlRepository.addUrl(longUrl, shortUrl);
} else { } else {
res.status(HttpStatus.BAD_REQUEST_400); res.status(HttpStatus.BAD_REQUEST_400);
return "shortUrl not valid ([a-z0-9]+)"; return "shortUrl not valid ([a-z0-9-_]+)";
} }
} }

View file

@ -6,7 +6,7 @@ import java.util.regex.Pattern;
public class Utils { public class Utils {
private static final Random random = new Random(System.currentTimeMillis()); 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); private static final Pattern PATTERN = Pattern.compile(SHORT_URL_PATTERN);
public static String randomString() { public static String randomString() {