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
149d5680
Unverified
Commit
149d5680
authored
Mar 31, 2020
by
Steven Allen
Committed by
GitHub
Mar 31, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #68 from ipfs/fix/loud-logging
fix: only log when we find a file we don't expect
parents
5498a827
4ae1b85a
Changes
1
Hide 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 @
149d5680
...
...
@@ -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