Skip to content

Commit c4cc3e8

Browse files
committed
Strip leading and trailing slashes and fail
1 parent 687a4d3 commit c4cc3e8

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/components/DirectoryListing.astro

Lines changed: 6 additions & 1 deletion
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) => {
@@ -57,7 +60,9 @@ function buildPageTree(parentPath: string, currentDepth: number): PageNode[] {
5760
const pageTree = buildPageTree(folder, baseDepth + 1);
5861
5962
if (pageTree.length === 0) {
60-
console.warn("DirectoryListing error")
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+
)
6166
}
6267
---
6368

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)