Commit 7ec19f16 authored by Kevin Atkinson's avatar Kevin Atkinson

Ignore non-directories in the top level directory.

Ignore non-directories in the top level directory to allow placing a
README or similar file there.
parent ac8ed745
...@@ -357,6 +357,16 @@ func (fs *Datastore) walk(path string, reschan chan query.Result) error { ...@@ -357,6 +357,16 @@ func (fs *Datastore) walk(path string, reschan chan query.Result) error {
return err return err
} }
defer dir.Close() defer dir.Close()
// ignore non-directories
fileInfo, err := dir.Stat()
if err != nil {
return err
}
if !fileInfo.IsDir() {
return nil
}
names, err := dir.Readdirnames(-1) names, err := dir.Readdirnames(-1)
if err != nil { if err != nil {
return err return err
......
...@@ -343,6 +343,11 @@ func testQuerySimple(dirFunc mkShardFunc, t *testing.T) { ...@@ -343,6 +343,11 @@ func testQuerySimple(dirFunc mkShardFunc, t *testing.T) {
temp, cleanup := tempdir(t) temp, cleanup := tempdir(t)
defer cleanup() defer cleanup()
err := ioutil.WriteFile(filepath.Join(temp, "README"), []byte("something"), 0666)
if err != nil {
t.Fatalf("WriteFile fail: %v\n", err)
}
fs, err := flatfs.New(temp, dirFunc(2), false) fs, err := flatfs.New(temp, dirFunc(2), false)
if err != nil { if err != nil {
t.Fatalf("New fail: %v\n", err) t.Fatalf("New fail: %v\n", err)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment