From a66bb9cdd1eed0b67f89b90a22f57687e5ef31d2 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Tue, 12 Dec 2017 12:16:01 +0100 Subject: [PATCH 1/2] allow 'Nextcloud' in the user agent string of Android Signed-off-by: Bjoern Schiessle --- lib/public/IRequest.php | 2 +- tests/lib/AppFramework/Http/RequestTest.php | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/public/IRequest.php b/lib/public/IRequest.php index 98d8f5bb83..83cf4c6914 100644 --- a/lib/public/IRequest.php +++ b/lib/public/IRequest.php @@ -66,7 +66,7 @@ interface IRequest { /** * @since 9.1.0 */ - const USER_AGENT_CLIENT_ANDROID = '/^Mozilla\/5\.0 \(Android\) ownCloud\-android.*$/'; + const USER_AGENT_CLIENT_ANDROID = '/^Mozilla\/5\.0 \(Android\) (ownCloud|Nextcloud)\-android.*$/'; /** * @since 9.1.0 diff --git a/tests/lib/AppFramework/Http/RequestTest.php b/tests/lib/AppFramework/Http/RequestTest.php index b1515b0efb..ce27f80e24 100644 --- a/tests/lib/AppFramework/Http/RequestTest.php +++ b/tests/lib/AppFramework/Http/RequestTest.php @@ -856,6 +856,20 @@ class RequestTest extends \Test\TestCase { ], false, ], + [ + 'Mozilla/5.0 (Android) ownCloud-android/2.0.0', + [ + Request::USER_AGENT_CLIENT_ANDROID + ], + true, + ], + [ + 'Mozilla/5.0 (Android) Nextcloud-android/2.0.0', + [ + Request::USER_AGENT_CLIENT_ANDROID + ], + true, + ], ]; } From 69d155b4690f6c3eb93b485561218f3ce245886a Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Tue, 12 Dec 2017 13:55:32 +0100 Subject: [PATCH 2/2] fix dav unit tests Signed-off-by: Bjoern Schiessle --- apps/dav/tests/unit/Connector/Sabre/AuthTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/dav/tests/unit/Connector/Sabre/AuthTest.php b/apps/dav/tests/unit/Connector/Sabre/AuthTest.php index dfcb793979..0bb207a814 100644 --- a/apps/dav/tests/unit/Connector/Sabre/AuthTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/AuthTest.php @@ -301,7 +301,7 @@ class AuthTest extends TestCase { ->method('isUserAgent') ->with([ '/^Mozilla\/5\.0 \([A-Za-z ]+\) (mirall|csyncoC)\/.*$/', - '/^Mozilla\/5\.0 \(Android\) ownCloud\-android.*$/', + '/^Mozilla\/5\.0 \(Android\) (ownCloud|Nextcloud)\-android.*$/', '/^Mozilla\/5\.0 \(iOS\) (ownCloud|Nextcloud)\-iOS.*$/', ]) ->willReturn(false); @@ -405,7 +405,7 @@ class AuthTest extends TestCase { ->method('isUserAgent') ->with([ '/^Mozilla\/5\.0 \([A-Za-z ]+\) (mirall|csyncoC)\/.*$/', - '/^Mozilla\/5\.0 \(Android\) ownCloud\-android.*$/', + '/^Mozilla\/5\.0 \(Android\) (ownCloud|Nextcloud)\-android.*$/', '/^Mozilla\/5\.0 \(iOS\) (ownCloud|Nextcloud)\-iOS.*$/', ]) ->willReturn(false); @@ -451,7 +451,7 @@ class AuthTest extends TestCase { ->method('isUserAgent') ->with([ '/^Mozilla\/5\.0 \([A-Za-z ]+\) (mirall|csyncoC)\/.*$/', - '/^Mozilla\/5\.0 \(Android\) ownCloud\-android.*$/', + '/^Mozilla\/5\.0 \(Android\) (ownCloud|Nextcloud)\-android.*$/', '/^Mozilla\/5\.0 \(iOS\) (ownCloud|Nextcloud)\-iOS.*$/', ]) ->willReturn(true);