From 4c7e60cff040d18711dc2b0720910c6dc2df6bd0 Mon Sep 17 00:00:00 2001 From: LBF38 Date: Sat, 2 Dec 2023 19:40:11 +0100 Subject: [PATCH] fix(config): :adhesive_bandage: update HTTPS files verification handle https files separately than other files as it shouldn't raise an error if not existing nor failing. --- .../syncthingandroid/service/SyncthingService.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/nutomic/syncthingandroid/service/SyncthingService.java b/app/src/main/java/com/nutomic/syncthingandroid/service/SyncthingService.java index 2a8798c11..ed8b8de61 100644 --- a/app/src/main/java/com/nutomic/syncthingandroid/service/SyncthingService.java +++ b/app/src/main/java/com/nutomic/syncthingandroid/service/SyncthingService.java @@ -699,11 +699,17 @@ public boolean importConfig() { Files.copy(config, Constants.getConfigFile(this)); Files.copy(privateKey, Constants.getPrivateKeyFile(this)); Files.copy(publicKey, Constants.getPublicKeyFile(this)); - Files.copy(httpsCert, Constants.getHttpsCertFile(this)); - Files.copy(httpsKey, Constants.getHttpsKeyFile(this)); } catch (IOException e) { Log.w(TAG, "Failed to import config", e); } + if (httpsCert.exists() && httpsKey.exists()) { + try { + Files.copy(httpsCert, Constants.getHttpsCertFile(this)); + Files.copy(httpsKey, Constants.getHttpsKeyFile(this)); + } catch (IOException e) { + Log.w(TAG, "Failed to import HTTPS config files", e); + } + } launchStartupTask(); }); return true;