Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-ds-flatfs
Commits
6787bc78
Commit
6787bc78
authored
Apr 09, 2020
by
Steven Allen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: skip non-directories
parent
862f5340
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
13 deletions
+9
-13
flatfs.go
flatfs.go
+9
-13
No files found.
flatfs.go
View file @
6787bc78
...
@@ -728,16 +728,20 @@ func (fs *Datastore) Query(q query.Query) (query.Results, error) {
...
@@ -728,16 +728,20 @@ func (fs *Datastore) Query(q query.Query) (query.Results, error) {
}
}
func
(
fs
*
Datastore
)
walkTopLevel
(
path
string
,
result
*
query
.
ResultBuilder
)
error
{
func
(
fs
*
Datastore
)
walkTopLevel
(
path
string
,
result
*
query
.
ResultBuilder
)
error
{
dir
,
err
:=
open
(
path
)
dir
,
err
:=
o
s
.
O
pen
(
path
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
defer
dir
.
Close
()
defer
dir
.
Close
()
nam
es
,
err
:=
dir
.
Readdir
names
(
-
1
)
entri
es
,
err
:=
dir
.
Readdir
(
-
1
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
for
_
,
dir
:=
range
names
{
for
_
,
entry
:=
range
entries
{
if
!
entry
.
IsDir
()
{
continue
}
dir
:=
entry
.
Name
()
if
len
(
dir
)
==
0
||
dir
[
0
]
==
'.'
{
if
len
(
dir
)
==
0
||
dir
[
0
]
==
'.'
{
continue
continue
}
}
...
@@ -1053,8 +1057,9 @@ func (fs *Datastore) tempFile() (*os.File, error) {
...
@@ -1053,8 +1057,9 @@ func (fs *Datastore) tempFile() (*os.File, error) {
return
file
,
err
return
file
,
err
}
}
// only call this on directories.
func
(
fs
*
Datastore
)
walk
(
path
string
,
qrb
*
query
.
ResultBuilder
)
error
{
func
(
fs
*
Datastore
)
walk
(
path
string
,
qrb
*
query
.
ResultBuilder
)
error
{
dir
,
err
:=
open
(
path
)
dir
,
err
:=
o
s
.
O
pen
(
path
)
if
err
!=
nil
{
if
err
!=
nil
{
if
os
.
IsNotExist
(
err
)
{
if
os
.
IsNotExist
(
err
)
{
// not an error if the file disappeared
// not an error if the file disappeared
...
@@ -1064,15 +1069,6 @@ func (fs *Datastore) walk(path string, qrb *query.ResultBuilder) error {
...
@@ -1064,15 +1069,6 @@ func (fs *Datastore) walk(path string, qrb *query.ResultBuilder) error {
}
}
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment