Change code for certificate handling to use the current coding style

This commit is contained in:
Martchus 2023-12-30 20:38:58 +01:00
parent e45db9d668
commit 18d90163ab
2 changed files with 3 additions and 3 deletions

View File

@ -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;

View File

@ -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;
} }