From 805a2b1e30e9815343c05c68f0c8b43875f6014b Mon Sep 17 00:00:00 2001 From: Johannes Endres Date: Wed, 1 Jan 2025 19:44:49 +0100 Subject: [PATCH 1/3] Change UserAgent to *cloud Signed-off-by: Johannes Endres --- .../tests/Check/RequestUserAgentTest.php | 16 ++++++++-------- lib/public/IRequest.php | 2 +- tests/lib/AppFramework/Http/RequestTest.php | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/apps/workflowengine/tests/Check/RequestUserAgentTest.php b/apps/workflowengine/tests/Check/RequestUserAgentTest.php index cc5cf3209b3bf..30e389c823631 100644 --- a/apps/workflowengine/tests/Check/RequestUserAgentTest.php +++ b/apps/workflowengine/tests/Check/RequestUserAgentTest.php @@ -42,45 +42,45 @@ public function dataExecuteCheck() { ['is', 'android', 'Mozilla/5.0 (iOS) Nextcloud-iOS/2.2.0', false], ['is', 'android', 'Mozilla/5.0 (Linux) mirall/2.2.0', false], ['is', 'android', 'Mozilla/5.0 (Windows) Nextcloud-Outlook v2.2.0', false], - ['is', 'android', 'Mozilla/5.0 (Linux) Nextcloud-Thunderbird v2.2.0', false], + ['is', 'android', 'Filelink for *cloud/2.2.0', false], ['!is', 'android', 'Mozilla/5.0 (Android) Nextcloud-android/2.2.0', false], ['!is', 'android', 'Mozilla/5.0 (iOS) Nextcloud-iOS/2.2.0', true], ['!is', 'android', 'Mozilla/5.0 (Linux) mirall/2.2.0', true], ['!is', 'android', 'Mozilla/5.0 (Windows) Nextcloud-Outlook v2.2.0', true], - ['!is', 'android', 'Mozilla/5.0 (Linux) Nextcloud-Thunderbird v2.2.0', true], + ['!is', 'android', 'Filelink for *cloud/2.2.0', true], ['is', 'ios', 'Mozilla/5.0 (Android) Nextcloud-android/2.2.0', false], ['is', 'ios', 'Mozilla/5.0 (iOS) Nextcloud-iOS/2.2.0', true], ['is', 'ios', 'Mozilla/5.0 (Linux) mirall/2.2.0', false], ['is', 'ios', 'Mozilla/5.0 (Windows) Nextcloud-Outlook v2.2.0', false], - ['is', 'ios', 'Mozilla/5.0 (Linux) Nextcloud-Thunderbird v2.2.0', false], + ['is', 'ios', 'Filelink for *cloud/2.2.0', false], ['!is', 'ios', 'Mozilla/5.0 (Android) Nextcloud-android/2.2.0', true], ['!is', 'ios', 'Mozilla/5.0 (iOS) Nextcloud-iOS/2.2.0', false], ['!is', 'ios', 'Mozilla/5.0 (Linux) mirall/2.2.0', true], ['!is', 'ios', 'Mozilla/5.0 (Windows) Nextcloud-Outlook v2.2.0', true], - ['!is', 'ios', 'Mozilla/5.0 (Linux) Nextcloud-Thunderbird v2.2.0', true], + ['!is', 'ios', 'Filelink for *cloud/2.2.0', true], ['is', 'desktop', 'Mozilla/5.0 (Android) Nextcloud-android/2.2.0', false], ['is', 'desktop', 'Mozilla/5.0 (iOS) Nextcloud-iOS/2.2.0', false], ['is', 'desktop', 'Mozilla/5.0 (Linux) mirall/2.2.0', true], ['is', 'desktop', 'Mozilla/5.0 (Windows) Nextcloud-Outlook v2.2.0', false], - ['is', 'desktop', 'Mozilla/5.0 (Linux) Nextcloud-Thunderbird v2.2.0', false], + ['is', 'desktop', 'Filelink for *cloud/2.2.0', false], ['!is', 'desktop', 'Mozilla/5.0 (Android) Nextcloud-android/2.2.0', true], ['!is', 'desktop', 'Mozilla/5.0 (iOS) Nextcloud-iOS/2.2.0', true], ['!is', 'desktop', 'Mozilla/5.0 (Linux) mirall/2.2.0', false], ['!is', 'desktop', 'Mozilla/5.0 (Windows) Nextcloud-Outlook v2.2.0', true], - ['!is', 'desktop', 'Mozilla/5.0 (Linux) Nextcloud-Thunderbird v2.2.0', true], + ['!is', 'desktop', 'Filelink for *cloud/2.2.0', true], ['is', 'mail', 'Mozilla/5.0 (Android) Nextcloud-android/2.2.0', false], ['is', 'mail', 'Mozilla/5.0 (iOS) Nextcloud-iOS/2.2.0', false], ['is', 'mail', 'Mozilla/5.0 (Linux) mirall/2.2.0', false], ['is', 'mail', 'Mozilla/5.0 (Windows) Nextcloud-Outlook v2.2.0', true], - ['is', 'mail', 'Mozilla/5.0 (Linux) Nextcloud-Thunderbird v2.2.0', true], + ['is', 'mail', 'Filelink for *cloud/2.2.0', true], ['!is', 'mail', 'Mozilla/5.0 (Android) Nextcloud-android/2.2.0', true], ['!is', 'mail', 'Mozilla/5.0 (iOS) Nextcloud-iOS/2.2.0', true], ['!is', 'mail', 'Mozilla/5.0 (Linux) mirall/2.2.0', true], ['!is', 'mail', 'Mozilla/5.0 (Windows) Nextcloud-Outlook v2.2.0', false], - ['!is', 'mail', 'Mozilla/5.0 (Linux) Nextcloud-Thunderbird v2.2.0', false], + ['!is', 'mail', 'Filelink for *cloud/2.2.0', false], ]; } diff --git a/lib/public/IRequest.php b/lib/public/IRequest.php index dedff769f7716..2639a234ad573 100644 --- a/lib/public/IRequest.php +++ b/lib/public/IRequest.php @@ -84,7 +84,7 @@ interface IRequest { * @since 13.0.1 * @since 28.0.0 The regex has a group matching the version number */ - public const USER_AGENT_THUNDERBIRD_ADDON = '/^Mozilla\/5\.0 \([A-Za-z ]+\) Nextcloud\-Thunderbird v([^ ]*).*$/'; + public const USER_AGENT_THUNDERBIRD_ADDON = '/^Filelink for \*cloud\/([1-9]\d*\.\d+\.\d+)$/'; /** * @since 26.0.0 diff --git a/tests/lib/AppFramework/Http/RequestTest.php b/tests/lib/AppFramework/Http/RequestTest.php index 1c7f07580cc66..a0851d819de40 100644 --- a/tests/lib/AppFramework/Http/RequestTest.php +++ b/tests/lib/AppFramework/Http/RequestTest.php @@ -1155,7 +1155,7 @@ public function dataMatchClientVersion(): array { '1.0.0', ], [ - 'Mozilla/5.0 (Linux) Nextcloud-Thunderbird v1.0.0', + 'Fielink for *cloud/1.0.0', Request::USER_AGENT_THUNDERBIRD_ADDON, '1.0.0', ], From a353dbb355afd265788ece388f8beaf2a082706f Mon Sep 17 00:00:00 2001 From: Johannes Endres Date: Sat, 4 Jan 2025 12:31:33 +0100 Subject: [PATCH 2/3] Update tests/lib/AppFramework/Http/RequestTest.php Co-authored-by: Daniel Signed-off-by: Johannes Endres --- tests/lib/AppFramework/Http/RequestTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/lib/AppFramework/Http/RequestTest.php b/tests/lib/AppFramework/Http/RequestTest.php index a0851d819de40..d331842092076 100644 --- a/tests/lib/AppFramework/Http/RequestTest.php +++ b/tests/lib/AppFramework/Http/RequestTest.php @@ -1155,7 +1155,7 @@ public function dataMatchClientVersion(): array { '1.0.0', ], [ - 'Fielink for *cloud/1.0.0', + 'Fileink for *cloud/1.0.0', Request::USER_AGENT_THUNDERBIRD_ADDON, '1.0.0', ], From 4ef6ee34f8c61b8315ee258731502bf86dd20724 Mon Sep 17 00:00:00 2001 From: Johannes Endres Date: Mon, 6 Jan 2025 17:03:05 +0100 Subject: [PATCH 3/3] Update tests/lib/AppFramework/Http/RequestTest.php Co-authored-by: Daniel Signed-off-by: Johannes Endres --- tests/lib/AppFramework/Http/RequestTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/lib/AppFramework/Http/RequestTest.php b/tests/lib/AppFramework/Http/RequestTest.php index d331842092076..fe3614ab88e25 100644 --- a/tests/lib/AppFramework/Http/RequestTest.php +++ b/tests/lib/AppFramework/Http/RequestTest.php @@ -1155,7 +1155,7 @@ public function dataMatchClientVersion(): array { '1.0.0', ], [ - 'Fileink for *cloud/1.0.0', + 'Filelink for *cloud/1.0.0', Request::USER_AGENT_THUNDERBIRD_ADDON, '1.0.0', ],