Skip to content

Commit 70f0a52

Browse files
committed
fix(templates): deduplicate provider templates
Signed-off-by: Elizabeth Danzberger <[email protected]>
1 parent 75edec9 commit 70f0a52

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
@@ -213,12 +213,18 @@ private function getProviderTemplates(TemplateFileCreator $type): array {
213213
foreach ($this->getRegisteredProviders() as $provider) {
214214
foreach ($type->getMimetypes() as $mimetype) {
215215
foreach ($provider->getCustomTemplates($mimetype) as $template) {
216-
$templates[] = $template;
216+
$templateId = $template->jsonSerialize()['templateId'];
217+
218+
if (array_key_exists($templateId, $templates)) {
219+
continue;
220+
}
221+
222+
$templates[$templateId] = $template;
217223
}
218224
}
219225
}
220226

221-
return $templates;
227+
return array_values($templates);
222228
}
223229

224230
/**

0 commit comments

Comments
 (0)