mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-26 23:28:14 +03:00
Correctly parse account server url when migration from legacy config
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
174a486428
commit
c496e73200
1 changed files with 24 additions and 9 deletions
|
@ -188,16 +188,31 @@ bool AccountManager::restoreFromLegacySettings()
|
|||
qCInfo(lcAccountManager) << "Migrate: overrideUrl" << cleanOverrideUrl;
|
||||
|
||||
if (!cleanOverrideUrl.isEmpty()) {
|
||||
const auto oCUrl = oCSettings->value(QLatin1String(urlC)).toString();
|
||||
const auto cleanOCUrl = oCUrl.endsWith('/') ? oCUrl.chopped(1) : oCUrl;
|
||||
oCSettings->beginGroup(QLatin1String(accountsC));
|
||||
const auto accountsChildGroups = oCSettings->childGroups();
|
||||
|
||||
// in case the urls are equal reset the settings object to read from
|
||||
// the ownCloud settings object
|
||||
qCInfo(lcAccountManager) << "Migrate oC config if " << cleanOCUrl << " == " << cleanOverrideUrl << ":"
|
||||
<< (cleanOCUrl == cleanOverrideUrl ? "Yes" : "No");
|
||||
if (cleanOCUrl == cleanOverrideUrl) {
|
||||
qCInfo(lcAccountManager) << "Copy settings" << oCSettings->allKeys().join(", ");
|
||||
settings = std::move(oCSettings);
|
||||
for (const auto &accountId : accountsChildGroups) {
|
||||
oCSettings->beginGroup(accountId);
|
||||
const auto oCUrl = oCSettings->value(QLatin1String(urlC)).toString();
|
||||
const auto cleanOCUrl = oCUrl.endsWith('/') ? oCUrl.chopped(1) : oCUrl;
|
||||
|
||||
// in case the urls are equal reset the settings object to read from
|
||||
// the ownCloud settings object
|
||||
qCInfo(lcAccountManager) << "Migrate oC config if " << cleanOCUrl << " == " << cleanOverrideUrl << ":"
|
||||
<< (cleanOCUrl == cleanOverrideUrl ? "Yes" : "No");
|
||||
if (cleanOCUrl == cleanOverrideUrl) {
|
||||
qCInfo(lcAccountManager) << "Copy settings" << oCSettings->allKeys().join(", ");
|
||||
oCSettings->endGroup(); // current accountID group
|
||||
oCSettings->endGroup(); // accounts group
|
||||
settings = std::move(oCSettings);
|
||||
break;
|
||||
}
|
||||
|
||||
oCSettings->endGroup();
|
||||
}
|
||||
|
||||
if (oCSettings) {
|
||||
oCSettings->endGroup();
|
||||
}
|
||||
} else {
|
||||
qCInfo(lcAccountManager) << "Copy settings" << oCSettings->allKeys().join(", ");
|
||||
|
|
Loading…
Reference in a new issue