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
6a4b1262
Commit
6a4b1262
authored
Jun 26, 2018
by
Kevin Atkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure you can't add URL's unless the url store is enabled.
License: MIT Signed-off-by:
Kevin Atkinson
<
k@kevina.org
>
parent
0c2efb90
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
4 deletions
+24
-4
core/commands/urlstore.go
core/commands/urlstore.go
+11
-0
test/sharness/t0272-urlstore.sh
test/sharness/t0272-urlstore.sh
+13
-4
No files found.
core/commands/urlstore.go
View file @
6a4b1262
...
...
@@ -56,6 +56,17 @@ time.
return
}
cfg
,
err
:=
n
.
Repo
.
Config
()
if
err
!=
nil
{
res
.
SetError
(
err
,
cmdkit
.
ErrNormal
)
return
}
if
!
cfg
.
Experimental
.
UrlstoreEnabled
{
res
.
SetError
(
fmt
.
Errorf
(
"URL store not enabled."
),
cmdkit
.
ErrNormal
)
return
}
hreq
,
err
:=
http
.
NewRequest
(
"GET"
,
url
,
nil
)
if
err
!=
nil
{
res
.
SetError
(
err
,
cmdkit
.
ErrNormal
)
...
...
test/sharness/t0272-urlstore.sh
View file @
6a4b1262
...
...
@@ -10,10 +10,6 @@ test_description="Test out the urlstore functionality"
test_init_ipfs
test_expect_success
"enable urlstore"
'
ipfs config --json Experimental.UrlstoreEnabled true
'
test_expect_success
"create some random files"
'
random 2222 7 > file1 &&
random 500000 7 > file2 &&
...
...
@@ -36,6 +32,19 @@ test_expect_success "make sure files can be retrived via the gateway" '
test_cmp file3 file3.actual
'
test_expect_success
"add files without enabling url store"
'
test_must_fail ipfs urlstore add http://127.0.0.1:$GWAY_PORT/ipfs/$HASH1a &&
test_must_fail ipfs urlstore add http://127.0.0.1:$GWAY_PORT/ipfs/$HASH2a
'
test_kill_ipfs_daemon
test_expect_success
"enable urlstore"
'
ipfs config --json Experimental.UrlstoreEnabled true
'
test_launch_ipfs_daemon
--offline
test_expect_success
"add files using gateway address via url store"
'
HASH1=$(ipfs urlstore add http://127.0.0.1:$GWAY_PORT/ipfs/$HASH1a) &&
HASH2=$(ipfs urlstore add http://127.0.0.1:$GWAY_PORT/ipfs/$HASH2a) &&
...
...
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