Change code for certificate handling to use the current coding style
This commit is contained in:
parent
e45db9d668
commit
18d90163ab
|
@ -795,13 +795,13 @@ bool SyncthingConnection::loadSelfSignedCertificate(const QUrl &url)
|
||||||
}
|
}
|
||||||
|
|
||||||
// find cert
|
// find cert
|
||||||
const QString certPath = !m_configDir.isEmpty() ? (m_configDir + QStringLiteral("/https-cert.pem")) : SyncthingConfig::locateHttpsCertificate();
|
const auto certPath = !m_configDir.isEmpty() ? (m_configDir + QStringLiteral("/https-cert.pem")) : SyncthingConfig::locateHttpsCertificate();
|
||||||
if (certPath.isEmpty()) {
|
if (certPath.isEmpty()) {
|
||||||
emit error(tr("Unable to locate certificate used by Syncthing."), SyncthingErrorCategory::OverallConnection, QNetworkReply::NoError);
|
emit error(tr("Unable to locate certificate used by Syncthing."), SyncthingErrorCategory::OverallConnection, QNetworkReply::NoError);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// add exception
|
// add exception
|
||||||
const QList<QSslCertificate> certs = QSslCertificate::fromPath(certPath);
|
const auto certs = QSslCertificate::fromPath(certPath);
|
||||||
if (certs.isEmpty() || certs.at(0).isNull()) {
|
if (certs.isEmpty() || certs.at(0).isNull()) {
|
||||||
emit error(tr("Unable to load certificate used by Syncthing."), SyncthingErrorCategory::OverallConnection, QNetworkReply::NoError);
|
emit error(tr("Unable to load certificate used by Syncthing."), SyncthingErrorCategory::OverallConnection, QNetworkReply::NoError);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -22,7 +22,7 @@ bool SyncthingConnectionSettings::loadHttpsCert()
|
||||||
if (httpsCertPath.isEmpty()) {
|
if (httpsCertPath.isEmpty()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
const auto certs(QSslCertificate::fromPath(httpsCertPath));
|
const auto certs = QSslCertificate::fromPath(httpsCertPath);
|
||||||
if (certs.isEmpty() || certs.at(0).isNull()) {
|
if (certs.isEmpty() || certs.at(0).isNull()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue