Skip to content

Commit 42c7cec

Browse files
kodster28maxvp
authored andcommitted
[Chore] DirectoryListing error if not returning items (#24637)
* [Chore] DirectoryListing error if not returning items * Strip leading and trailing slashes and fail
1 parent ad93d2e commit 42c7cec

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/components/DirectoryListing.astro

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ let { descriptions, folder, maxDepth, tag } = props.parse(Astro.props);
2222
2323
if (!folder) folder = Astro.params.slug!;
2424
25+
// Strip leading or trailing slashes
26+
folder = folder.replace(/^\/|\/$/g, '')
27+
2528
const baseDepth = folder.split("/").length;
2629
2730
let allPages = await getCollection("docs", (page) => {
@@ -55,6 +58,12 @@ function buildPageTree(parentPath: string, currentDepth: number): PageNode[] {
5558
}
5659
5760
const pageTree = buildPageTree(folder, baseDepth + 1);
61+
62+
if (pageTree.length === 0) {
63+
throw new Error (
64+
`[DirectoryListing] Bad folder parameter (determined by current folder OR the "folder" input) of "${folder}". Check to make sure "${folder}" exists, has child pages, .`
65+
)
66+
}
5867
---
5968

6069
<ul>

src/content/docs/fundamentals/reference/partners.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Our third-party integrations allow you to deploy the WARP client application and
3333

3434
Enterprise customers have access to detailed logs of the metadata generated by our products, and logs from Cloudflare solutions can be pushed to a variety of log management providers and storage services.
3535

36-
<DirectoryListing folder="logs/get-started/enable-destinations" />
36+
<DirectoryListing folder="/logs/logpush/logpush-job/enable-destinations/" />
3737

3838
## ​​Cloudflare Technology Partners for Magic WAN
3939

0 commit comments

Comments
 (0)