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-unixfs
Commits
89002295
Commit
89002295
authored
Nov 17, 2014
by
Matt Bell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commands/http: Made MultiFileReader#Read more readable
parent
c9abc6b5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
11 deletions
+6
-11
commands/http/multifilereader.go
commands/http/multifilereader.go
+6
-11
No files found.
commands/http/multifilereader.go
View file @
89002295
...
...
@@ -90,21 +90,16 @@ func (mfr *MultiFileReader) Read(buf []byte) (written int, err error) {
}
}
var
reader
io
.
Reader
if
mfr
.
buf
.
Len
()
>
0
{
// if the buffer has something in it, read from it
reader
=
&
mfr
.
buf
}
else
if
mfr
.
currentFile
!=
nil
{
// otherwise, read from file data
reader
=
mfr
.
currentFile
if
mfr
.
buf
.
Len
()
>
0
{
return
mfr
.
buf
.
Read
(
buf
)
}
written
,
err
=
reader
.
Read
(
buf
)
if
err
==
io
.
EOF
&&
reader
==
mfr
.
currentFile
{
// otherwise, read from file data
written
,
err
=
mfr
.
currentFile
.
Read
(
buf
)
if
err
==
io
.
EOF
{
mfr
.
currentFile
=
nil
return
mfr
.
Read
(
buf
)
return
written
,
nil
}
return
written
,
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