fix: only show files that are actually in the folder

This commit is contained in:
Zen Visser 2025-01-17 06:45:03 +01:00 committed by GitHub
parent 8cf3e3001f
commit e34e1e0ff3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -36,7 +36,7 @@ export default ((opts?: Partial<FolderContentOptions>) => {
allFiles.forEach((file) => { allFiles.forEach((file) => {
const fileSlug = stripSlashes(simplifySlug(file.slug!)) const fileSlug = stripSlashes(simplifySlug(file.slug!))
const prefixed = fileSlug.startsWith(folderSlug) && fileSlug !== folderSlug const prefixed = fileSlug.startsWith(`${folderSlug}/`) && fileSlug !== folderSlug
const fileParts = fileSlug.split(path.posix.sep) const fileParts = fileSlug.split(path.posix.sep)
const isDirectChild = fileParts.length === folderParts.length + 1 const isDirectChild = fileParts.length === folderParts.length + 1