Skip to content

Commit 963e49d

Browse files
authored
Merge pull request #94 from nativeui-org/hotfix
fix(registry): handle .json extension in componentName param
2 parents 1644ab6 + 92e9f59 commit 963e49d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

app/registry/[componentName]/route.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ export async function GET(
77
{ params }: { params: Promise<{ componentName: string }> }
88

99
) {
10-
const { componentName } = await params;
10+
let { componentName } = await params;
11+
12+
// Supprimer l'extension .json si elle est présente
13+
if (componentName.endsWith('.json')) {
14+
componentName = componentName.slice(0, -5); // Enlève les 5 derniers caractères (.json)
15+
}
1116

1217
try {
1318
const filePath = join(process.cwd(), 'public', 'r', `${componentName}.json`);

0 commit comments

Comments
 (0)