From: Camila Date: Wed, 1 Feb 2023 19:56:34 +0000 (+0100) Subject: Fix: if the config did not exist, overrideserverurl had no effect. X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~11^2~14^2~1 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=23db86bdf02590dff07ef04f43c34a3133513ac6;p=nextcloud-desktop.git Fix: if the config did not exist, overrideserverurl had no effect. When the client runs for the first time, setting the value was done before the config file was created. It had no effect. Signed-off-by: Camila --- diff --git a/src/gui/application.cpp b/src/gui/application.cpp index ed7b15c37..9f8d522f5 100644 --- a/src/gui/application.cpp +++ b/src/gui/application.cpp @@ -337,6 +337,19 @@ Application::Application(int &argc, char **argv) } ConfigFile cfg; + + { + // these config values will always be empty after the first client run + if (!_overrideServerUrl.isEmpty()) { + cfg.setOverrideServerUrl(_overrideServerUrl); + } + + if (!_overrideLocalDir.isEmpty()) { + cfg.setOverrideLocalDir(_overrideLocalDir); + } + } + + // The timeout is initialized with an environment variable, if not, override with the value from the config if (!AbstractNetworkJob::httpTimeout) AbstractNetworkJob::httpTimeout = cfg.timeout(); @@ -713,14 +726,14 @@ void Application::parseOptions(const QStringList &options) showHint("Invalid URL passed to --overrideserverurl"); shouldExit = true; } else { - ConfigFile().setOverrideServerUrl(overrideUrl); + _overrideServerUrl = overrideUrl; } } else { showHint("Invalid URL passed to --overrideserverurl"); } } else if (option == QStringLiteral("--overridelocaldir")) { if (it.hasNext() && !it.peekNext().startsWith(QLatin1String("--"))) { - ConfigFile().setOverrideLocalDir(it.next()); + _overrideLocalDir = it.next(); } else { showHint("Invalid URL passed to --overridelocaldir"); } diff --git a/src/gui/application.h b/src/gui/application.h index 5bd412077..8ae193264 100644 --- a/src/gui/application.h +++ b/src/gui/application.h @@ -145,6 +145,9 @@ private: QNetworkConfigurationManager _networkConfigurationManager; QTimer _checkConnectionTimer; + QString _overrideServerUrl; + QString _overrideLocalDir; + #if defined(WITH_CRASHREPORTER) QScopedPointer _crashHandler; #endif