Skip to content

Commit 344c82f

Browse files
authored
Merge pull request #187 from nextcloud/fix/provider-register-event
fix: Trigger both OCA and OCP ContentProviderRegisterEvent
2 parents a9d1a09 + 6eea508 commit 344c82f

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

lib/Public/ContentManager.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
use OCA\ContextChat\BackgroundJobs\SubmitContentJob;
1313
use OCA\ContextChat\Db\QueueContentItem;
1414
use OCA\ContextChat\Db\QueueContentItemMapper;
15-
use OCA\ContextChat\Event\ContentProviderRegisterEvent;
1615
use OCA\ContextChat\Logger;
1716
use OCA\ContextChat\Service\ActionScheduler;
1817
use OCA\ContextChat\Service\ProviderConfigService;
@@ -91,7 +90,9 @@ public function registerContentProvider(string $appId, string $providerId, strin
9190
* @since 2.2.2
9291
*/
9392
public function collectAllContentProviders(): void {
94-
$providerCollectionEvent = new ContentProviderRegisterEvent($this);
93+
$providerCollectionEvent = new \OCA\ContextChat\Event\ContentProviderRegisterEvent($this);
94+
$this->eventDispatcher->dispatchTyped($providerCollectionEvent);
95+
$providerCollectionEvent = new \OCP\ContextChat\Events\ContentProviderRegisterEvent($this);
9596
$this->eventDispatcher->dispatchTyped($providerCollectionEvent);
9697
}
9798

lib/Service/MetadataService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function getEnrichedProviders(): array {
8686

8787
private function getIdFromSource(string $sourceId): string {
8888
// note the ":" in the item id part
89-
if (!preg_match('/^[a-zA-Z0-9_-]+__[a-zA-Z0-9_-]+: ([a-zA-Z0-9:-])+$/', $sourceId, $matches)) {
89+
if (!preg_match('/^[a-zA-Z0-9_-]+__[a-zA-Z0-9_-]+: ([a-zA-Z0-9:-]+)$/', $sourceId, $matches)) {
9090
throw new \InvalidArgumentException("Invalid source id $sourceId");
9191
}
9292
return $matches[1];

0 commit comments

Comments
 (0)