summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
Diffstat (limited to 'src/network')
-rw-r--r--src/network/ssl/qsslcertificate.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp
index db20f5618b..8b5be7ae00 100644
--- a/src/network/ssl/qsslcertificate.cpp
+++ b/src/network/ssl/qsslcertificate.cpp
@@ -876,8 +876,11 @@ QList<QSslCertificate> QSslCertificate::fromPath(const QString &path,
// Check if the path is a file.
if (QFileInfo(sourcePath).isFile()) {
QFile file(sourcePath);
- if (file.open(QIODevice::ReadOnly | QIODevice::Text))
- return QSslCertificate::fromData(file.readAll(),format);
+ QIODevice::OpenMode openMode = QIODevice::ReadOnly;
+ if (format == QSsl::Pem)
+ openMode |= QIODevice::Text;
+ if (file.open(openMode))
+ return QSslCertificate::fromData(file.readAll(), format);
return QList<QSslCertificate>();
}
}
@@ -899,8 +902,11 @@ QList<QSslCertificate> QSslCertificate::fromPath(const QString &path,
continue;
QFile file(filePath);
- if (file.open(QIODevice::ReadOnly | QIODevice::Text))
- certs += QSslCertificate::fromData(file.readAll(),format);
+ QIODevice::OpenMode openMode = QIODevice::ReadOnly;
+ if (format == QSsl::Pem)
+ openMode |= QIODevice::Text;
+ if (file.open(openMode))
+ certs += QSslCertificate::fromData(file.readAll(), format);
}
return certs;
}