Commit e7eb937d authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

Fix opening some password protected documents

e.g. the ones in poppler issue 824

The PDF spec doesn't say (or I couldn't find it) how a user entered
string is converted to the byte array needed for password checking, so
we try both latin1 and utf8
parent 46bc21bf
Pipeline #117819 passed with stage
in 27 minutes and 52 seconds
......@@ -623,9 +623,13 @@ Okular::Document::OpenResult PDFGenerator::init(QVector<Okular::Page *> &pagesVe
pdfdoc->unlock(password.toLatin1(), password.toLatin1());
if (pdfdoc->isLocked()) {
delete pdfdoc;
pdfdoc = nullptr;
return Okular::Document::OpenNeedsPassword;
pdfdoc->unlock(password.toUtf8(), password.toUtf8());
if (pdfdoc->isLocked()) {
delete pdfdoc;
pdfdoc = nullptr;
return Okular::Document::OpenNeedsPassword;
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment