chg: [inbox:createEntry] Checks for remote back connection is more flexible

Handle the case of trailing slash
pull/93/head
Sami Mokaddem 2022-01-24 17:37:32 +01:00
parent 670c5abaae
commit 38caafb76e
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
1 changed files with 4 additions and 1 deletions

View File

@ -64,8 +64,11 @@ class InboxTable extends AppTable
$this->Broods = \Cake\ORM\TableRegistry::getTableLocator()->get('Broods');
$this->Individuals = \Cake\ORM\TableRegistry::getTableLocator()->get('Individuals');
$errors = [];
$originUrl = trim($entryData['origin'], '/');
$brood = $this->Broods->find()
->where(['url' => $entryData['origin']])
->where([
'url IN' => [$originUrl, "{$originUrl}/"]
])
->first();
if (empty($brood)) {
$errors[] = __('Unkown brood `{0}`', $entryData['data']['cerebrateURL']);