Fix email template loading (#21718)

* ugly exception for templates

* Ignore folders that aren't valid extensions

* Add changeset

* Don't double-loop

* Super small polishing

---------

Co-authored-by: Rijk van Zanten <rijkvanzanten@me.com>
Co-authored-by: Pascal Jufer <pascal-jufer@bluewin.ch>
This commit is contained in:
Brainslug
2024-03-06 20:30:26 +01:00
committed by GitHub
parent 1058ea143a
commit 81e0f4c021
2 changed files with 12 additions and 2 deletions

View File

@@ -0,0 +1,5 @@
---
'@directus/extensions': patch
---
Fixed an issue that would cause extensions loading to fail when non-extension folders were included in the extensions folder

View File

@@ -80,14 +80,19 @@ export async function resolveFsExtensions(root: string): Promise<Map<string, Ext
const manifest: Record<string, any> = await fse.readJSON(join(path, 'package.json'));
return { name: folder, path, manifest };
} catch {
throw new Error(`Extension "${folder}" (${path}) does not contain a package.json file.`);
// Ignore invalid extensions or non-extension folders
return;
}
}),
);
const extensions = new Map();
for (const { name, path, manifest } of extensionMap.values()) {
for (const extension of extensionMap.values()) {
if (!extension) continue;
const { name, path, manifest } = extension;
let parsedManifest;
try {