From 7c65fe2f654d283172e053a75eb7f010fcabd411 Mon Sep 17 00:00:00 2001 From: sowjanyakch Date: Wed, 25 Feb 2026 17:44:20 +0100 Subject: [PATCH 1/3] fix account name Signed-off-by: sowjanyakch --- .../android/common/core/utils/ecosystem/EcosystemManager.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/com/nextcloud/android/common/core/utils/ecosystem/EcosystemManager.kt b/core/src/main/java/com/nextcloud/android/common/core/utils/ecosystem/EcosystemManager.kt index 52012194..72b95b0b 100644 --- a/core/src/main/java/com/nextcloud/android/common/core/utils/ecosystem/EcosystemManager.kt +++ b/core/src/main/java/com/nextcloud/android/common/core/utils/ecosystem/EcosystemManager.kt @@ -39,7 +39,11 @@ class EcosystemManager( private const val PLAY_STORE_MARKET_LINK = "market://details?id=" private const val EXTRA_KEY_ACCOUNT = "KEY_ACCOUNT" - const val ACCOUNT_NAME_PATTERN_REGEX = "[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-z]{2,}" + const val ACCOUNT_NAME_PATTERN_REGEX = "^[A-Za-z0-9._%+-]+(?:" + + "@(?:[A-Za-z0-9-]+\\.)+[A-Za-z]{2,}(?:@(?:[A-Za-z0-9-]+\\.)+[A-Za-z]{2,})?" + + "|" + + "@(?:\\d{1,3}\\.){2,3}\\d{1,3}(?::\\d{1,5})?" + + ")$" } private val accountNamePattern = Pattern.compile(ACCOUNT_NAME_PATTERN_REGEX) From e6de36242e63d11f9472644a01fc394d8afc8237 Mon Sep 17 00:00:00 2001 From: alperozturk96 Date: Thu, 26 Feb 2026 08:23:46 +0100 Subject: [PATCH 2/3] add tests for new pattern Signed-off-by: alperozturk96 --- .../android/common/core/utils/AccountNamePatternTest.kt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/src/test/java/com/nextcloud/android/common/core/utils/AccountNamePatternTest.kt b/core/src/test/java/com/nextcloud/android/common/core/utils/AccountNamePatternTest.kt index e725a7f8..56c63f28 100644 --- a/core/src/test/java/com/nextcloud/android/common/core/utils/AccountNamePatternTest.kt +++ b/core/src/test/java/com/nextcloud/android/common/core/utils/AccountNamePatternTest.kt @@ -52,4 +52,11 @@ class AccountNamePatternTest { assertFalse(pattern.matcher("").matches()) assertFalse(pattern.matcher(" ").matches()) } + + @Test + fun `special account name formats`() { + assertTrue(pattern.matcher("abc@cloud.com@example.inst2.cloud.com").matches()) + assertTrue(pattern.matcher("admin@10.0.2.2:55002").matches()) + assertTrue(pattern.matcher("admin@10.0.2.2").matches()) + } } From d4944feca2a7f9d9958e9517614a7156a7126b9b Mon Sep 17 00:00:00 2001 From: alperozturk96 Date: Thu, 26 Feb 2026 08:33:22 +0100 Subject: [PATCH 3/3] fix spotless check Signed-off-by: alperozturk96 --- .../common/core/utils/ecosystem/EcosystemManager.kt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/com/nextcloud/android/common/core/utils/ecosystem/EcosystemManager.kt b/core/src/main/java/com/nextcloud/android/common/core/utils/ecosystem/EcosystemManager.kt index 72b95b0b..635a7176 100644 --- a/core/src/main/java/com/nextcloud/android/common/core/utils/ecosystem/EcosystemManager.kt +++ b/core/src/main/java/com/nextcloud/android/common/core/utils/ecosystem/EcosystemManager.kt @@ -39,11 +39,12 @@ class EcosystemManager( private const val PLAY_STORE_MARKET_LINK = "market://details?id=" private const val EXTRA_KEY_ACCOUNT = "KEY_ACCOUNT" - const val ACCOUNT_NAME_PATTERN_REGEX = "^[A-Za-z0-9._%+-]+(?:" + - "@(?:[A-Za-z0-9-]+\\.)+[A-Za-z]{2,}(?:@(?:[A-Za-z0-9-]+\\.)+[A-Za-z]{2,})?" + - "|" + - "@(?:\\d{1,3}\\.){2,3}\\d{1,3}(?::\\d{1,5})?" + - ")$" + const val ACCOUNT_NAME_PATTERN_REGEX = + "^[A-Za-z0-9._%+-]+(?:" + + "@(?:[A-Za-z0-9-]+\\.)+[A-Za-z]{2,}(?:@(?:[A-Za-z0-9-]+\\.)+[A-Za-z]{2,})?" + + "|" + + "@(?:\\d{1,3}\\.){2,3}\\d{1,3}(?::\\d{1,5})?" + + ")$" } private val accountNamePattern = Pattern.compile(ACCOUNT_NAME_PATTERN_REGEX)