Skip to content

Commit b5fc422

Browse files
elzodyjuliusknorr
authored andcommitted
fix(templates): deduplicate provider templates
Signed-off-by: Elizabeth Danzberger <[email protected]>
1 parent bae24eb commit b5fc422

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/private/Files/Template/TemplateManager.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,12 +223,18 @@ private function getProviderTemplates(TemplateFileCreator $type): array {
223223
foreach ($this->getRegisteredProviders() as $provider) {
224224
foreach ($type->getMimetypes() as $mimetype) {
225225
foreach ($provider->getCustomTemplates($mimetype) as $template) {
226-
$templates[] = $template;
226+
$templateId = $template->jsonSerialize()['templateId'];
227+
228+
if (array_key_exists($templateId, $templates)) {
229+
continue;
230+
}
231+
232+
$templates[$templateId] = $template;
227233
}
228234
}
229235
}
230236

231-
return $templates;
237+
return array_values($templates);
232238
}
233239

234240
/**

0 commit comments

Comments
 (0)