Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
4bcacc59
提交
4bcacc59
authored
9月 02, 2015
作者:
Jeromy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
address most of CR comments
License: MIT Signed-off-by:
Jeromy
<
jeromyj@gmail.com
>
上级
9bbd9b06
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
21 行增加
和
31 行删除
+21
-31
multipartfile.go
commands/files/multipartfile.go
+3
-1
multifilereader.go
commands/http/multifilereader.go
+1
-2
readonly_unix.go
fuse/readonly/readonly_unix.go
+17
-28
没有找到文件。
commands/files/multipartfile.go
浏览文件 @
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
==
"symlink"
{
if
contentType
==
applicationSymlink
{
out
,
err
:=
ioutil
.
ReadAll
(
part
)
if
err
!=
nil
{
return
nil
,
err
...
...
commands/http/multifilereader.go
浏览文件 @
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
浏览文件 @
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
())
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论