diff options
author | Björn Schießle <bjoern@schiessle.org> | 2017-12-12 14:37:46 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-12 14:37:46 +0100 |
commit | acb395cade066139bec85f2ba30f7e646ddac0ca (patch) | |
tree | 24c9ba0bc146710833f18e8bba4a89b69a505419 | |
parent | 14c83e415c2e1e748c335fcb48a5b979240ecb9d (diff) | |
parent | caff52decdcf9f08c01245338d8e1eba59ac15a0 (diff) | |
download | nextcloud-server-acb395cade066139bec85f2ba30f7e646ddac0ca.tar.gz nextcloud-server-acb395cade066139bec85f2ba30f7e646ddac0ca.zip |
Merge pull request #7462 from nextcloud/update-user-agent-regex
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 f94afb257de..a449b8f9431 100644 --- a/apps/dav/tests/unit/Connector/Sabre/AuthTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/AuthTest.php @@ -303,7 +303,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); @@ -407,7 +407,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); @@ -453,7 +453,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 c4f59f85d4a..a14b6b5f459 100644 --- a/lib/public/IRequest.php +++ b/lib/public/IRequest.php @@ -67,7 +67,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 13.0.0 diff --git a/tests/lib/AppFramework/Http/RequestTest.php b/tests/lib/AppFramework/Http/RequestTest.php index d3f36a6d886..cc55e33f354 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, + ], ]; } |