From 102d4dc1afe9df113247f29be0bbae52bb376046 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Mon, 29 Aug 2016 11:52:44 +0200 Subject: [PATCH] Allow space for federated share id search --- apps/files_sharing/lib/API/Sharees.php | 2 +- apps/files_sharing/tests/API/ShareesTest.php | 52 ++++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/apps/files_sharing/lib/API/Sharees.php b/apps/files_sharing/lib/API/Sharees.php index a7eb13708f3..efa3ce6ff56 100644 --- a/apps/files_sharing/lib/API/Sharees.php +++ b/apps/files_sharing/lib/API/Sharees.php @@ -319,7 +319,7 @@ class Sharees { $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/API/ShareesTest.php b/apps/files_sharing/tests/API/ShareesTest.php index 041b45216af..d20fd49260b 100644 --- a/apps/files_sharing/tests/API/ShareesTest.php +++ b/apps/files_sharing/tests/API/ShareesTest.php @@ -943,6 +943,58 @@ class ShareesTest 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, + ], ]; }