Skip to content

Commit 93797b2

Browse files
authored
Merge pull request #7468 from nextcloud/update-user-agent-regex-stable12
allow 'Nextcloud' in the user agent string of Android
2 parents f44d5bd + 1a4eab7 commit 93797b2

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

apps/dav/tests/unit/Connector/Sabre/AuthTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ public function testAuthenticateAlreadyLoggedInWithoutCsrfTokenAndCorrectlyDavAu
301301
->method('isUserAgent')
302302
->with([
303303
'/^Mozilla\/5\.0 \([A-Za-z ]+\) (mirall|csyncoC)\/.*$/',
304-
'/^Mozilla\/5\.0 \(Android\) ownCloud\-android.*$/',
304+
'/^Mozilla\/5\.0 \(Android\) (ownCloud|Nextcloud)\-android.*$/',
305305
'/^Mozilla\/5\.0 \(iOS\) (ownCloud|Nextcloud)\-iOS.*$/',
306306
])
307307
->willReturn(false);
@@ -405,7 +405,7 @@ public function testAuthenticateAlreadyLoggedInWithoutCsrfTokenAndIncorrectlyDav
405405
->method('isUserAgent')
406406
->with([
407407
'/^Mozilla\/5\.0 \([A-Za-z ]+\) (mirall|csyncoC)\/.*$/',
408-
'/^Mozilla\/5\.0 \(Android\) ownCloud\-android.*$/',
408+
'/^Mozilla\/5\.0 \(Android\) (ownCloud|Nextcloud)\-android.*$/',
409409
'/^Mozilla\/5\.0 \(iOS\) (ownCloud|Nextcloud)\-iOS.*$/',
410410
])
411411
->willReturn(false);
@@ -451,7 +451,7 @@ public function testAuthenticateAlreadyLoggedInWithoutCsrfTokenForNonGetAndDeskt
451451
->method('isUserAgent')
452452
->with([
453453
'/^Mozilla\/5\.0 \([A-Za-z ]+\) (mirall|csyncoC)\/.*$/',
454-
'/^Mozilla\/5\.0 \(Android\) ownCloud\-android.*$/',
454+
'/^Mozilla\/5\.0 \(Android\) (ownCloud|Nextcloud)\-android.*$/',
455455
'/^Mozilla\/5\.0 \(iOS\) (ownCloud|Nextcloud)\-iOS.*$/',
456456
])
457457
->willReturn(true);

lib/public/IRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ interface IRequest {
6666
/**
6767
* @since 9.1.0
6868
*/
69-
const USER_AGENT_CLIENT_ANDROID = '/^Mozilla\/5\.0 \(Android\) ownCloud\-android.*$/';
69+
const USER_AGENT_CLIENT_ANDROID = '/^Mozilla\/5\.0 \(Android\) (ownCloud|Nextcloud)\-android.*$/';
7070

7171
/**
7272
* @since 9.1.0

tests/lib/AppFramework/Http/RequestTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -859,6 +859,20 @@ function userAgentProvider() {
859859
],
860860
false,
861861
],
862+
[
863+
'Mozilla/5.0 (Android) ownCloud-android/2.0.0',
864+
[
865+
Request::USER_AGENT_CLIENT_ANDROID
866+
],
867+
true,
868+
],
869+
[
870+
'Mozilla/5.0 (Android) Nextcloud-android/2.0.0',
871+
[
872+
Request::USER_AGENT_CLIENT_ANDROID
873+
],
874+
true,
875+
],
862876
];
863877
}
864878

0 commit comments

Comments
 (0)