mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 18:56:34 +01:00
[GnomeKeyring] Make tests pass with gnome-keyring backend.
Fixed PasswordManager::urlEncodePassword - ~ is also needed to encode
This commit is contained in:
parent
a5a5cfbbf0
commit
972af5552d
@ -174,7 +174,8 @@ QByteArray PasswordManager::urlEncodePassword(const QString &password)
|
|||||||
{
|
{
|
||||||
// Exclude space to properly decode to +
|
// Exclude space to properly decode to +
|
||||||
QByteArray encodedPass = QUrl::toPercentEncoding(password, " ");
|
QByteArray encodedPass = QUrl::toPercentEncoding(password, " ");
|
||||||
encodedPass.replace(' ', '+');
|
encodedPass.replace(' ', '+'); // space has to be encoded to +
|
||||||
|
encodedPass.replace('~', "%7E"); // ~ is unreserved char, needs to be manually encoded
|
||||||
return encodedPass;
|
return encodedPass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,16 +29,16 @@ static PasswordEntry createEntry(GnomeKeyringFound* item)
|
|||||||
{
|
{
|
||||||
PasswordEntry entry;
|
PasswordEntry entry;
|
||||||
entry.id = item->item_id;
|
entry.id = item->item_id;
|
||||||
entry.password = item->secret;
|
entry.password = QString::fromUtf8(item->secret);
|
||||||
|
|
||||||
for (unsigned i = 0; i < item->attributes->len; ++i) {
|
for (unsigned i = 0; i < item->attributes->len; ++i) {
|
||||||
GnomeKeyringAttribute attr = g_array_index(item->attributes, GnomeKeyringAttribute, i);
|
GnomeKeyringAttribute attr = g_array_index(item->attributes, GnomeKeyringAttribute, i);
|
||||||
|
|
||||||
if (strcmp(attr.name, "host") == 0) {
|
if (strcmp(attr.name, "host") == 0) {
|
||||||
entry.host = attr.value.string;
|
entry.host = QString::fromUtf8(attr.value.string);
|
||||||
}
|
}
|
||||||
else if (strcmp(attr.name, "username") == 0) {
|
else if (strcmp(attr.name, "username") == 0) {
|
||||||
entry.username = attr.value.string;
|
entry.username = QString::fromUtf8(attr.value.string);
|
||||||
}
|
}
|
||||||
else if (strcmp(attr.name, "data") == 0) {
|
else if (strcmp(attr.name, "data") == 0) {
|
||||||
entry.data = attr.value.string;
|
entry.data = attr.value.string;
|
||||||
|
Loading…
Reference in New Issue
Block a user