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
4bcacc59
Commit
4bcacc59
authored
Sep 02, 2015
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
address most of CR comments
License: MIT Signed-off-by:
Jeromy
<
jeromyj@gmail.com
>
parent
9bbd9b06
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
31 deletions
+21
-31
commands/files/multipartfile.go
commands/files/multipartfile.go
+3
-1
commands/http/multifilereader.go
commands/http/multifilereader.go
+1
-2
fuse/readonly/readonly_unix.go
fuse/readonly/readonly_unix.go
+17
-28
No files found.
commands/files/multipartfile.go
View file @
4bcacc59
...
...
@@ -12,6 +12,8 @@ const (
multipartFormdataType
=
"multipart/form-data"
multipartMixedType
=
"multipart/mixed"
applicationSymlink
=
"application/symlink"
contentTypeHeader
=
"Content-Type"
)
...
...
@@ -31,7 +33,7 @@ func NewFileFromPart(part *multipart.Part) (File, error) {
}
contentType
:=
part
.
Header
.
Get
(
contentTypeHeader
)
if
contentType
==
"s
ymlink
"
{
if
contentType
==
applicationS
ymlink
{
out
,
err
:=
ioutil
.
ReadAll
(
part
)
if
err
!=
nil
{
return
nil
,
err
...
...
commands/http/multifilereader.go
View file @
4bcacc59
...
...
@@ -69,8 +69,7 @@ func (mfr *MultiFileReader) Read(buf []byte) (written int, err error) {
if
s
,
ok
:=
file
.
(
*
files
.
Symlink
);
ok
{
mfr
.
currentFile
=
s
// TODO(why): this is a hack. pick a real contentType
contentType
=
"symlink"
contentType
=
"application/symlink"
}
else
if
file
.
IsDirectory
()
{
// if file is a directory, create a multifilereader from it
// (using 'multipart/mixed')
...
...
fuse/readonly/readonly_unix.go
View file @
4bcacc59
...
...
@@ -8,7 +8,6 @@ import (
"io"
"os"
"syscall"
"time"
fuse
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/bazil.org/fuse"
fs
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/bazil.org/fuse/fs"
...
...
@@ -60,8 +59,6 @@ func (s *Root) Lookup(ctx context.Context, name string) (fs.Node, error) {
return
nil
,
fuse
.
ENOENT
}
log
.
Error
(
"RESOLVE: "
,
name
)
ctx
,
_
=
context
.
WithTimeout
(
ctx
,
time
.
Second
/
2
)
nd
,
err
:=
s
.
Ipfs
.
Resolver
.
ResolvePath
(
ctx
,
path
.
Path
(
name
))
if
err
!=
nil
{
// todo: make this error more versatile.
...
...
@@ -100,35 +97,27 @@ func (s *Node) Attr(ctx context.Context, a *fuse.Attr) error {
}
switch
s
.
cached
.
GetType
()
{
case
ftpb
.
Data_Directory
:
*
a
=
fuse
.
Attr
{
Mode
:
os
.
ModeDir
|
0555
,
Uid
:
uint32
(
os
.
Getuid
()),
Gid
:
uint32
(
os
.
Getgid
()),
}
a
.
Mode
=
os
.
ModeDir
|
0555
a
.
Uid
=
uint32
(
os
.
Getuid
())
a
.
Gid
=
uint32
(
os
.
Getgid
())
case
ftpb
.
Data_File
:
size
:=
s
.
cached
.
GetFilesize
()
*
a
=
fuse
.
Attr
{
Mode
:
0444
,
Size
:
uint64
(
size
),
Blocks
:
uint64
(
len
(
s
.
Nd
.
Links
)),
Uid
:
uint32
(
os
.
Getuid
()),
Gid
:
uint32
(
os
.
Getgid
()),
}
a
.
Mode
=
0444
a
.
Size
=
uint64
(
size
)
a
.
Blocks
=
uint64
(
len
(
s
.
Nd
.
Links
))
a
.
Uid
=
uint32
(
os
.
Getuid
())
a
.
Gid
=
uint32
(
os
.
Getgid
())
case
ftpb
.
Data_Raw
:
*
a
=
fuse
.
Attr
{
Mode
:
0444
,
Size
:
uint64
(
len
(
s
.
cached
.
GetData
())),
Blocks
:
uint64
(
len
(
s
.
Nd
.
Links
)),
Uid
:
uint32
(
os
.
Getuid
()),
Gid
:
uint32
(
os
.
Getgid
()),
}
a
.
Mode
=
0444
a
.
Size
=
uint64
(
len
(
s
.
cached
.
GetData
()))
a
.
Blocks
=
uint64
(
len
(
s
.
Nd
.
Links
))
a
.
Uid
=
uint32
(
os
.
Getuid
())
a
.
Gid
=
uint32
(
os
.
Getgid
())
case
ftpb
.
Data_Symlink
:
*
a
=
fuse
.
Attr
{
Mode
:
0777
|
os
.
ModeSymlink
,
Size
:
uint64
(
len
(
s
.
cached
.
GetData
())),
Uid
:
uint32
(
os
.
Getuid
()),
Gid
:
uint32
(
os
.
Getgid
()),
}
a
.
Mode
=
0777
|
os
.
ModeSymlink
a
.
Size
=
uint64
(
len
(
s
.
cached
.
GetData
()))
a
.
Uid
=
uint32
(
os
.
Getuid
())
a
.
Gid
=
uint32
(
os
.
Getgid
())
default
:
return
fmt
.
Errorf
(
"Invalid data type - %s"
,
s
.
cached
.
GetType
())
...
...
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