From 1f20c18ad6e032038e7d1b2a35795de2ca2ef24a Mon Sep 17 00:00:00 2001 From: Philipp Crocoll Date: Mon, 19 Aug 2019 12:10:27 +0200 Subject: [PATCH] fix creation of IfDevice string, closes #888 --- src/keepass2android/KeeAutoExec.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/keepass2android/KeeAutoExec.cs b/src/keepass2android/KeeAutoExec.cs index a4724c5a..567b7dd6 100644 --- a/src/keepass2android/KeeAutoExec.cs +++ b/src/keepass2android/KeeAutoExec.cs @@ -138,6 +138,8 @@ namespace keepass2android TrimFields = true }; + bool hasEnabledDevices = devices.Any(kvp => kvp.Value); + string result = ""; foreach (var deviceWithEnabled in devices) { @@ -145,6 +147,9 @@ namespace keepass2android { result += opt.FieldSeparator; } + //if the list of devices has enabled devices, we do not need to include a negated expression + if (hasEnabledDevices && !deviceWithEnabled.Value) + continue; string deviceValue = (deviceWithEnabled.Value ? "" : "!") + deviceWithEnabled.Key; if (deviceValue.Contains(opt.FieldSeparator) || deviceValue.Contains("\\") || deviceValue.Contains("\""))