Skip to content

Commit

Permalink
Merge pull request #12 from jarxorg/hotfix-memfs-store
Browse files Browse the repository at this point in the history
Fix store.prefixKeys issues
  • Loading branch information
mojatter authored Nov 16, 2021
2 parents 44d705b + c19479c commit 7c79d42
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion memfs/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func (s *store) prefixKeys(prefix string) []string {
break
}
if strings.Contains(key[len(prefix):], "/") {
break
continue
}
keys = append(keys, key)
}
Expand Down
5 changes: 5 additions & 0 deletions memfs/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ var testStoreSrc = map[string]*value{
"/dir1": {name: "dir0", mode: fs.ModePerm, isDir: true},
"/dir1/file11.txt": {name: "dir1/file11.txt", mode: fs.ModePerm, isDir: false},
"/dir1/file12.txt": {name: "dir1/file12.txt", mode: fs.ModePerm, isDir: false},
"/file1.txt": {name: "file1.txt", mode: fs.ModePerm, isDir: false},
"/file2.txt": {name: "file2.txt", mode: fs.ModePerm, isDir: false},
}

func newStoreTest() *store {
Expand Down Expand Up @@ -149,6 +151,9 @@ func TestStore_prefixKeys(t *testing.T) {
{
want: []string{
"/dir0",
"/dir1",
"/file1.txt",
"/file2.txt",
},
prefix: "/",
}, {
Expand Down

0 comments on commit 7c79d42

Please sign in to comment.