diff options
| author | David Cole <40234707+DavidArthurCole@users.noreply.github.com> | 2024-10-19 17:45:24 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-19 23:45:24 +0200 |
| commit | fffc1fac5ae6eb87ad556ff7e1ce8337279f7464 (patch) | |
| tree | 31bc20562a75650cebb498263c129e5b593c8ebd | |
| parent | f4b8e0ee050e8e003f8a7fb65ed2e3b9550bec79 (diff) | |
| download | SkyHanni-fffc1fac5ae6eb87ad556ff7e1ce8337279f7464.tar.gz SkyHanni-fffc1fac5ae6eb87ad556ff7e1ce8337279f7464.tar.bz2 SkyHanni-fffc1fac5ae6eb87ad556ff7e1ce8337279f7464.zip | |
Fix: Brave Downloads Cutting `host` (#2761)
| -rw-r--r-- | src/main/java/at/hannibal2/skyhanni/tweaker/DownloadSourceChecker.java | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/tweaker/DownloadSourceChecker.java b/src/main/java/at/hannibal2/skyhanni/tweaker/DownloadSourceChecker.java index 7947b6ebc..8596b5fb2 100644 --- a/src/main/java/at/hannibal2/skyhanni/tweaker/DownloadSourceChecker.java +++ b/src/main/java/at/hannibal2/skyhanni/tweaker/DownloadSourceChecker.java @@ -13,6 +13,8 @@ import java.io.FileReader; import java.net.URI; import java.net.URL; import java.util.concurrent.atomic.AtomicBoolean; +import java.util.regex.Matcher; +import java.util.regex.Pattern; public class DownloadSourceChecker { @@ -78,9 +80,20 @@ public class DownloadSourceChecker { } )); + // Compile the regex pattern for matching an empty host + Pattern pattern = Pattern.compile("https:\\/\\/.*.com\\/$|about:internet"); + Matcher matcher = pattern.matcher(uriToSimpleString(host)); + + // Check if the host is empty (Brave is cutting everything past .com/ from the host) + String cutHostMessage = ""; + if (matcher.find()) { + cutHostMessage = "\n\nYour browser MAY have interfered with the download process.\n" + + "Try downloading the file using a different browser (Microsoft Edge, Google Chrome, etc.)."; + } + JOptionPane.showOptionDialog( frame, - String.format(String.join("\n", SECURITY_POPUP), uriToSimpleString(host)), + String.format(String.join("\n", SECURITY_POPUP), uriToSimpleString(host)) + cutHostMessage, "SkyHanni " + MOD_VERSION + " Security Error", JOptionPane.DEFAULT_OPTION, JOptionPane.ERROR_MESSAGE, |
