We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b87885e commit 2985820Copy full SHA for 2985820
src/utils/documents.server.ts
@@ -595,11 +595,19 @@ async function fetchApiContentsRemote(
595
const directoryFiles =
596
(await directoryFilesResponse.json()) as Array<GitHubFile>
597
598
- file.children = await buildFileTree(
599
- directoryFiles,
600
- depth + 1,
601
- `${parentPath}${file.path}/`,
602
- )
+ if (!Array.isArray(directoryFiles)) {
+ console.warn(
+ `Expected an array of files from GitHub API for directory ${file.path}, but received:\n`,
+ JSON.stringify(directoryFiles),
+ )
603
+ // Leave file.children undefined
604
+ } else {
605
+ file.children = await buildFileTree(
606
+ directoryFiles,
607
+ depth + 1,
608
+ `${parentPath}${file.path}/`,
609
610
+ }
611
}
612
613
result.push(file)
0 commit comments