diff options
author | Morris Jobke <hey@morrisjobke.de> | 2017-12-12 17:44:55 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-12 17:44:55 +0300 |
commit | 93797b2e5d8cc8fa5f6ea1190037e2d7a69602f9 (patch) | |
tree | 9ace747030045ad8af2e5bea086beb2264796b08 | |
parent | f44d5bde5604eab628a4194fb2d111aa84ca2082 (diff) | |
parent | 1a4eab744e83713ff5cd7dc6d8532a43aa385ef7 (diff) |
Merge pull request #7468 from nextcloud/update-user-agent-regex-stable12
allow 'Nextcloud' in the user agent string of Android
-rw-r--r-- | apps/dav/tests/unit/Connector/Sabre/AuthTest.php | 6 | ||||
-rw-r--r-- | lib/public/IRequest.php | 2 | ||||
-rw-r--r-- | tests/lib/AppFramework/Http/RequestTest.php | 14 |
3 files changed, 18 insertions, 4 deletions
diff --git a/apps/dav/tests/unit/Connector/Sabre/AuthTest.php b/apps/dav/tests/unit/Connector/Sabre/AuthTest.php index dfcb7939799..0bb207a814b 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); diff --git a/lib/public/IRequest.php b/lib/public/IRequest.php index 98d8f5bb83a..83cf4c69147 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 f80bffcb480..40a9193dc92 100644 --- a/tests/lib/AppFramework/Http/RequestTest.php +++ b/tests/lib/AppFramework/Http/RequestTest.php @@ -859,6 +859,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, + ], ]; } |