Bug fix UI crash when url is unrechable (#1642)
* feat: Add URL reachability check in ConvertWebsiteToPDF * Add tests for URL reachability in ConvertWebsiteToPdfTest * test: Update URL in ConvertWebsiteToPdfTest for testing
This commit is contained in:
@@ -39,6 +39,12 @@ public class ConvertWebsiteToPDF {
|
||||
if (!URL.matches("^https?://.*") || !GeneralUtils.isValidURL(URL)) {
|
||||
throw new IllegalArgumentException("Invalid URL format provided.");
|
||||
}
|
||||
|
||||
// validate the URL is reachable
|
||||
if (!GeneralUtils.isURLReachable(URL)) {
|
||||
throw new IllegalArgumentException("URL is not reachable, please provide a valid URL.");
|
||||
}
|
||||
|
||||
Path tempOutputFile = null;
|
||||
byte[] pdfBytes;
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user