feat: add https protocol to urls without protocol in Browser
This commit is contained in:
parent
c804bb243a
commit
35b8699f9f
|
@ -130,7 +130,7 @@ Rectangle {
|
|||
}
|
||||
return
|
||||
}
|
||||
if (appSettings.shouldShowBrowserSearchEngine !== Constants.browserSearchEngineNone && !Utils.isURL(text)) {
|
||||
if (appSettings.shouldShowBrowserSearchEngine !== Constants.browserSearchEngineNone && !Utils.isURL(text) && !Utils.isURLWithOptionalProtocol(text)) {
|
||||
switch (appSettings.shouldShowBrowserSearchEngine) {
|
||||
case Constants.browserSearchEngineGoogle: currentWebView.url = "https://www.google.com/search?q=" + text; break;
|
||||
case Constants.browserSearchEngineYahoo: currentWebView.url = "https://search.yahoo.com/search?p=" + text; break;
|
||||
|
@ -138,6 +138,8 @@ Rectangle {
|
|||
}
|
||||
|
||||
return
|
||||
} else if (Utils.isURLWithOptionalProtocol(text)) {
|
||||
text = "https://" + text
|
||||
}
|
||||
|
||||
currentWebView.url = determineRealURL(text);
|
||||
|
|
|
@ -337,6 +337,10 @@ QtObject {
|
|||
return (/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/.test(text))
|
||||
}
|
||||
|
||||
function isURLWithOptionalProtocol(text) {
|
||||
return (/^(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/.test(text))
|
||||
}
|
||||
|
||||
function isHexColor(c) {
|
||||
return (/^#([0-9A-Fa-f]{6}|[0-9A-Fa-f]{3})$/i.test(c))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue