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-dms3
Commits
a2f15faa
Commit
a2f15faa
authored
Dec 18, 2018
by
Łukasz Magiera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
files2.0: address review
License: MIT Signed-off-by:
Łukasz Magiera
<
magik6k@gmail.com
>
parent
1fe28bc6
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
5 deletions
+11
-5
cmd/ipfs/init.go
cmd/ipfs/init.go
+8
-4
core/commands/cat.go
core/commands/cat.go
+1
-1
core/commands/cmdenv/file.go
core/commands/cmdenv/file.go
+1
-0
core/coreapi/interface/errors.go
core/coreapi/interface/errors.go
+1
-0
No files found.
cmd/ipfs/init.go
View file @
a2f15faa
...
@@ -87,15 +87,19 @@ environment variable:
...
@@ -87,15 +87,19 @@ environment variable:
f
:=
req
.
Files
f
:=
req
.
Files
if
f
!=
nil
{
if
f
!=
nil
{
it
:=
req
.
Files
.
Entries
()
it
:=
req
.
Files
.
Entries
()
if
!
it
.
Next
()
&&
it
.
Err
()
!=
nil
{
if
!
it
.
Next
()
{
if
it
.
Err
()
!=
nil
{
return
it
.
Err
()
return
it
.
Err
()
}
}
if
files
.
FileFromEntry
(
it
)
==
nil
{
return
fmt
.
Errorf
(
"file argument was nil"
)
}
file
:=
files
.
FileFromEntry
(
it
)
if
file
==
nil
{
return
fmt
.
Errorf
(
"expected a regular file"
)
return
fmt
.
Errorf
(
"expected a regular file"
)
}
}
conf
=
&
config
.
Config
{}
conf
=
&
config
.
Config
{}
if
err
:=
json
.
NewDecoder
(
file
s
.
FileFromEntry
(
it
)
)
.
Decode
(
conf
);
err
!=
nil
{
if
err
:=
json
.
NewDecoder
(
file
)
.
Decode
(
conf
);
err
!=
nil
{
return
err
return
err
}
}
}
}
...
...
core/commands/cat.go
View file @
a2f15faa
...
@@ -130,7 +130,7 @@ func cat(ctx context.Context, api iface.CoreAPI, paths []string, offset int64, m
...
@@ -130,7 +130,7 @@ func cat(ctx context.Context, api iface.CoreAPI, paths []string, offset int64, m
file
,
ok
:=
f
.
(
files
.
File
)
file
,
ok
:=
f
.
(
files
.
File
)
if
!
ok
{
if
!
ok
{
return
nil
,
0
,
iface
.
Err
IsDir
return
nil
,
0
,
iface
.
Err
NotFile
}
}
fsize
,
err
:=
file
.
Size
()
fsize
,
err
:=
file
.
Size
()
...
...
core/commands/cmdenv/file.go
View file @
a2f15faa
...
@@ -6,6 +6,7 @@ import (
...
@@ -6,6 +6,7 @@ import (
files
"gx/ipfs/QmXWZCd8jfaHmt4UDSnjKmGcrQMw95bDGWqEeVLVJjoANX/go-ipfs-files"
files
"gx/ipfs/QmXWZCd8jfaHmt4UDSnjKmGcrQMw95bDGWqEeVLVJjoANX/go-ipfs-files"
)
)
// GetFileArg returns the next file from the directory or an error
func
GetFileArg
(
it
files
.
DirIterator
)
(
files
.
File
,
error
)
{
func
GetFileArg
(
it
files
.
DirIterator
)
(
files
.
File
,
error
)
{
if
!
it
.
Next
()
{
if
!
it
.
Next
()
{
err
:=
it
.
Err
()
err
:=
it
.
Err
()
...
...
core/coreapi/interface/errors.go
View file @
a2f15faa
...
@@ -4,5 +4,6 @@ import "errors"
...
@@ -4,5 +4,6 @@ import "errors"
var
(
var
(
ErrIsDir
=
errors
.
New
(
"this dag node is a directory"
)
ErrIsDir
=
errors
.
New
(
"this dag node is a directory"
)
ErrNotFile
=
errors
.
New
(
"this dag node is not a regular file"
)
ErrOffline
=
errors
.
New
(
"this action must be run in online mode, try running 'ipfs daemon' first"
)
ErrOffline
=
errors
.
New
(
"this action must be run in online mode, try running 'ipfs daemon' first"
)
)
)
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