Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
ed551131
提交
ed551131
authored
7月 25, 2016
作者:
Jeromy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
commands: fix panic when expected files field is nil
License: MIT Signed-off-by:
Jeromy
<
why@ipfs.io
>
上级
566c08e2
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
19 行增加
和
6 行删除
+19
-6
parse.go
commands/http/parse.go
+7
-3
request.go
commands/request.go
+2
-1
t0600-issues-and-regressions-online.sh
test/sharness/t0600-issues-and-regressions-online.sh
+10
-2
没有找到文件。
commands/http/parse.go
浏览文件 @
ed551131
...
...
@@ -104,13 +104,17 @@ func Parse(r *http.Request, root *cmds.Command) (cmds.Request, error) {
contentType
:=
r
.
Header
.
Get
(
contentTypeHeader
)
mediatype
,
_
,
_
:=
mime
.
ParseMediaType
(
contentType
)
var
f
*
files
.
Multipart
File
var
f
files
.
File
if
mediatype
==
"multipart/form-data"
{
f
=
&
files
.
MultipartFile
{
Mediatype
:
mediatype
}
f
.
Reader
,
err
=
r
.
MultipartReader
()
reader
,
err
:=
r
.
MultipartReader
()
if
err
!=
nil
{
return
nil
,
err
}
f
=
&
files
.
MultipartFile
{
Mediatype
:
mediatype
,
Reader
:
reader
,
}
}
// if there is a required filearg, error if no files were provided
...
...
commands/request.go
浏览文件 @
ed551131
...
...
@@ -231,7 +231,8 @@ func (r *request) VarArgs(f func(string) error) error {
}
if
r
.
files
==
nil
{
return
fmt
.
Errorf
(
"expected more arguments from stdin"
)
log
.
Warning
(
"expected more arguments from stdin"
)
return
nil
}
fi
,
err
:=
r
.
files
.
NextFile
()
...
...
test/sharness/t0600-issues-and-regressions-online.sh
浏览文件 @
ed551131
...
...
@@ -10,15 +10,23 @@ test_launch_ipfs_daemon
# Tests go here
test_expect_sucess
"commands command with flag flags works via HTTP API - #2301"
'
test_expect_suc
c
ess
"commands command with flag flags works via HTTP API - #2301"
'
curl "http://$API_ADDR/api/v0/commands?flags" | grep "verbose"
'
test_expect_sucess
"ipfs refs local over HTTP API returns NDJOSN not flat - #2803"
'
test_expect_suc
c
ess
"ipfs refs local over HTTP API returns NDJOSN not flat - #2803"
'
echo "Hello World" | ipfs add &&
curl "http://$API_ADDR/api/v0/refs/local" | grep "Ref" | grep "Err"
'
test_expect_success
"args expecting stdin dont crash when not given"
'
curl "$API_ADDR/api/v0/bootstrap/add" > result
'
test_expect_success
"no panic traces on daemon"
'
test_expect_failure grep "nil pointer dereference" daemon_err
'
test_kill_ipfs_daemon
test_done
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论