Skip to content

Commit

Permalink
Update SearchTable.java
Browse files Browse the repository at this point in the history
  • Loading branch information
bit4woo committed Aug 14, 2024
1 parent 2644739 commit f6862d7
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/InternetSearch/SearchTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.apache.commons.lang3.StringUtils;

import com.bit4woo.utilbox.utils.SystemUtils;
import com.bit4woo.utilbox.utils.TextUtils;

import GUI.GUIMain;
import base.Commons;
Expand Down Expand Up @@ -150,7 +151,18 @@ public void mouseClicked(MouseEvent e) {
if (StringUtils.isEmpty(url)) {
return;
}
if (!url.toLowerCase().startsWith("http://") && !url.toLowerCase().startsWith("https://")) {
String lowerUrl = url.toLowerCase();
if (lowerUrl.contains("://")) {
String protocol = lowerUrl.substring(0,lowerUrl.indexOf("://"));
List<String> protocols = TextUtils.textToLines("http\r\n"
+ "https\r\n"
+ "ftp\r\n"
+ "sftp");
if (!protocols.contains(protocol)) {
url = url.substring(url.indexOf("://"));
url = "http://"+url;
}
}else {
url = "http://"+url;//针对DNS记录中URL字段是host的情况
}
SystemUtils.browserOpen(url,ConfigManager.getStringConfigByKey(ConfigName.BrowserPath));
Expand Down

0 comments on commit f6862d7

Please sign in to comment.