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
4ae1b85a
Commit
4ae1b85a
authored
Mar 31, 2020
by
Steven Allen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: only log when we find a file we don't expect
We _expect_ temporary put- files.
parent
a348e6ec
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
flatfs.go
flatfs.go
+7
-2
No files found.
flatfs.go
View file @
4ae1b85a
...
...
@@ -290,7 +290,12 @@ func (fs *Datastore) encode(key datastore.Key) (dir, file string) {
}
func
(
fs
*
Datastore
)
decode
(
file
string
)
(
key
datastore
.
Key
,
ok
bool
)
{
if
filepath
.
Ext
(
file
)
!=
extension
{
if
!
strings
.
HasSuffix
(
file
,
extension
)
{
// We expect random files like "put-". Log when we encounter
// others.
if
!
strings
.
HasPrefix
(
file
,
"put-"
)
{
log
.
Warnw
(
"failed to decode flatfs filename"
,
"file"
,
file
)
}
return
datastore
.
Key
{},
false
}
name
:=
file
[
:
len
(
file
)
-
len
(
extension
)]
...
...
@@ -1064,7 +1069,7 @@ func (fs *Datastore) walk(path string, qrb *query.ResultBuilder) error {
key
,
ok
:=
fs
.
decode
(
fn
)
if
!
ok
{
log
.
Warnw
(
"failed to decode flatfs entry"
,
"file"
,
fn
)
// not a block.
continue
}
...
...
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