-
Notifications
You must be signed in to change notification settings - Fork 165
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Environment
Tested with unstorage v1.15.0
Reproduction
import { createStorage } from "unstorage";
import fsDriver from "unstorage/drivers/fs";
import { writeFile, mkdir } from "fs/promises";
import { join } from "path";
const testFolders = join("dir1", "dir2");
await mkdir(testFolders, { recursive: true });
const storage = await createStorage({
driver: fsDriver({
base: "./dir1",
ignore: "**/dir2/test.txt",
}),
});
await writeFile("./dir1/dir2/test.txt", "");
console.log(await storage.getKeys());
This code outputs [ 'dir2:test.txt' ]
but I would expect it to output []
.
Describe the bug
When creating a fsDriver
a ignore
patterns can be specified.
When listing keys with getKeys
files that match an ignore pattern are still returned in some cases.
This happens if the parent path of the file does not match an ignore pattern.
The ignore pattern still correctly excludes files from being watched for changes.
So it appears that the ignore patterns are applied correctly when setting up file watching, but not when applied for listing keys.
Additional context
No response
Logs
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working