mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-03-28 17:42:40 +01:00
fix: hide dot-prefixed folders in media panel
Filter out directories starting with '.' when listing folders
in the media panel. These hidden folders (like .git, .hidden)
were appearing in the media browser unexpectedly.
Added !dir.name.startsWith('.') to three readdirAsync filter
chains in MediaHelpers.ts: selectedFolder scan (line 217),
content folder scan (line 228), and static folder scan (line 246).
Fixes #509
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -214,7 +214,7 @@ export class MediaHelpers {
|
||||
if (selectedFolder) {
|
||||
if (await existsAsync(selectedFolder)) {
|
||||
foldersFromSelection = (await readdirAsync(selectedFolder, { withFileTypes: true }))
|
||||
.filter((dir) => dir.isDirectory())
|
||||
.filter((dir) => dir.isDirectory() && !dir.name.startsWith('.'))
|
||||
.map((dir) => parseWinPath(join(selectedFolder, dir.name)));
|
||||
}
|
||||
}
|
||||
@@ -225,7 +225,7 @@ export class MediaHelpers {
|
||||
const contentPath = contentFolder.path;
|
||||
if (contentPath && (await existsAsync(contentPath))) {
|
||||
const subFolders = (await readdirAsync(contentPath, { withFileTypes: true }))
|
||||
.filter((dir) => dir.isDirectory())
|
||||
.filter((dir) => dir.isDirectory() && !dir.name.startsWith('.'))
|
||||
.map((dir) => parseWinPath(join(contentPath, dir.name)));
|
||||
allContentFolders = [...allContentFolders, ...subFolders];
|
||||
}
|
||||
@@ -243,7 +243,7 @@ export class MediaHelpers {
|
||||
|
||||
if (staticPath && (await existsAsync(staticPath))) {
|
||||
allFolders = (await readdirAsync(staticPath, { withFileTypes: true }))
|
||||
.filter((dir) => dir.isDirectory())
|
||||
.filter((dir) => dir.isDirectory() && !dir.name.startsWith('.'))
|
||||
.map((dir) => parseWinPath(join(staticPath, dir.name)));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user