summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-08-29 11:52:44 +0200
committerLukas Reschke <lukas@statuscode.ch>2016-08-30 11:11:59 +0200
commitec9fd67bc54850a1f4d9e76df75815bf8bb8672e (patch)
tree52850de39ac08a30db7a9bdedf23b2d95c616d4a /apps
parentf4dfd1f1a31eda3b89d846a619698b688571a4e2 (diff)
downloadnextcloud-server-ec9fd67bc54850a1f4d9e76df75815bf8bb8672e.tar.gz
nextcloud-server-ec9fd67bc54850a1f4d9e76df75815bf8bb8672e.zip
Allow space for federated share id search
Diffstat (limited to 'apps')
-rw-r--r--apps/files_sharing/lib/Controller/ShareesAPIController.php2
-rw-r--r--apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php52
2 files changed, 53 insertions, 1 deletions
diff --git a/apps/files_sharing/lib/Controller/ShareesAPIController.php b/apps/files_sharing/lib/Controller/ShareesAPIController.php
index b884aa9f1d4..a2063803450 100644
--- a/apps/files_sharing/lib/Controller/ShareesAPIController.php
+++ b/apps/files_sharing/lib/Controller/ShareesAPIController.php
@@ -321,7 +321,7 @@ class ShareesAPIController extends OCSController {
$this->result['remotes'] = [];
}
- if (!$foundRemoteById && substr_count($search, '@') >= 1 && substr_count($search, ' ') === 0 && $this->offset === 0) {
+ if (!$foundRemoteById && substr_count($search, '@') >= 1 && $this->offset === 0) {
$this->result['exact']['remotes'][] = [
'label' => $search,
'value' => [
diff --git a/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php b/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php
index 5cb073ecf08..161cc8a184b 100644
--- a/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php
+++ b/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php
@@ -945,6 +945,58 @@ class ShareesAPIControllerTest extends TestCase {
[],
true,
],
+ // contact with space
+ [
+ 'user name@localhost',
+ [
+ [
+ 'FN' => 'User3 @ Localhost',
+ ],
+ [
+ 'FN' => 'User2 @ Localhost',
+ 'CLOUD' => [
+ ],
+ ],
+ [
+ 'FN' => 'User Name @ Localhost',
+ 'CLOUD' => [
+ 'user name@localhost',
+ ],
+ ],
+ ],
+ false,
+ [
+ ['label' => 'User Name @ Localhost', 'value' => ['shareType' => Share::SHARE_TYPE_REMOTE, 'shareWith' => 'user name@localhost', 'server' => 'localhost']],
+ ],
+ [],
+ true,
+ ],
+ // remote with space, no contact
+ [
+ 'user space@remote',
+ [
+ [
+ 'FN' => 'User3 @ Localhost',
+ ],
+ [
+ 'FN' => 'User2 @ Localhost',
+ 'CLOUD' => [
+ ],
+ ],
+ [
+ 'FN' => 'User @ Localhost',
+ 'CLOUD' => [
+ 'username@localhost',
+ ],
+ ],
+ ],
+ false,
+ [
+ ['label' => 'user space@remote', 'value' => ['shareType' => Share::SHARE_TYPE_REMOTE, 'shareWith' => 'user space@remote']],
+ ],
+ [],
+ true,
+ ],
];
}