mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-11-22 16:00:38 -05:00
check if url is valid
This commit is contained in:
parent
a888de19cd
commit
691e60d72b
2 changed files with 17 additions and 13 deletions
|
|
@ -795,22 +795,24 @@ QString Entry::resolvePlaceholder(const QString& str) const
|
|||
QString Entry::resolveUrl(const QString& url) const
|
||||
{
|
||||
#ifdef WITH_XC_HTTP
|
||||
QString newurl = url;
|
||||
QString newUrl = url;
|
||||
if (!url.contains("://")) {
|
||||
// URL doesn't have a protocol, add https by default
|
||||
newurl.prepend("https://");
|
||||
newUrl.prepend("https://");
|
||||
}
|
||||
QUrl uurl = QUrl(newurl);
|
||||
QUrl tempUrl = QUrl(newUrl);
|
||||
|
||||
if (uurl.scheme() == "cmd") {
|
||||
// URL is a cmd, hopefully the second argument is an URL
|
||||
QStringList cmd = newurl.split(" ");
|
||||
if (cmd.size() > 1) {
|
||||
return resolveUrl(cmd[1].remove("'").remove("\""));
|
||||
if (tempUrl.isValid()) {
|
||||
if (tempUrl.scheme() == "cmd") {
|
||||
// URL is a cmd, hopefully the second argument is an URL
|
||||
QStringList cmd = newUrl.split(" ");
|
||||
if (cmd.size() > 1) {
|
||||
return resolveUrl(cmd[1].remove("'").remove("\""));
|
||||
}
|
||||
} else if (tempUrl.scheme() == "http" || tempUrl.scheme() == "https") {
|
||||
// URL is nice
|
||||
return tempUrl.url();
|
||||
}
|
||||
} else if (uurl.scheme() == "http" || uurl.scheme() == "https") {
|
||||
// URL is nice
|
||||
return uurl.url();
|
||||
}
|
||||
#else
|
||||
Q_UNUSED(url);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue