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
ffe35df8
Unverified
Commit
ffe35df8
authored
Apr 29, 2020
by
Steven Allen
Committed by
GitHub
Apr 29, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7219 from ipfs/fix/listing-header
feat(gateway): show the absolute path and CID every time
parents
4847083a
46ae0217
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
8 deletions
+5
-8
core/corehttp/gateway_handler.go
core/corehttp/gateway_handler.go
+2
-5
core/corehttp/gateway_test.go
core/corehttp/gateway_test.go
+3
-3
No files found.
core/corehttp/gateway_handler.go
View file @
ffe35df8
...
...
@@ -330,15 +330,12 @@ func (i *gatewayHandler) getOrHeadHandler(w http.ResponseWriter, r *http.Request
}
}
var
hash
string
if
!
strings
.
HasPrefix
(
urlPath
,
ipfsPathPrefix
)
{
hash
=
resolvedPath
.
Cid
()
.
String
()
}
hash
:=
resolvedPath
.
Cid
()
.
String
()
// See comment above where originalUrlPath is declared.
tplData
:=
listingTemplateData
{
Listing
:
dirListing
,
Path
:
originalU
rlPath
,
Path
:
u
rlPath
,
BackLink
:
backLink
,
Hash
:
hash
,
}
...
...
core/corehttp/gateway_test.go
View file @
ffe35df8
...
...
@@ -378,7 +378,7 @@ func TestIPNSHostnameBacklinks(t *testing.T) {
s
:=
string
(
body
)
t
.
Logf
(
"body: %s
\n
"
,
string
(
body
))
if
!
strings
.
Contains
(
s
,
"Index of /foo? #<'/"
)
{
if
!
strings
.
Contains
(
s
,
"Index of
/ipns/example.net
/foo? #<'/"
)
{
t
.
Fatalf
(
"expected a path in directory listing"
)
}
if
!
strings
.
Contains
(
s
,
"<a href=
\"
/foo%3F%20%23%3C%27/./..
\"
>"
)
{
...
...
@@ -444,7 +444,7 @@ func TestIPNSHostnameBacklinks(t *testing.T) {
s
=
string
(
body
)
t
.
Logf
(
"body: %s
\n
"
,
string
(
body
))
if
!
strings
.
Contains
(
s
,
"Index of /foo? #<'/bar/"
)
{
if
!
strings
.
Contains
(
s
,
"Index of
/ipns/example.net
/foo? #<'/bar/"
)
{
t
.
Fatalf
(
"expected a path in directory listing"
)
}
if
!
strings
.
Contains
(
s
,
"<a href=
\"
/foo%3F%20%23%3C%27/bar/./..
\"
>"
)
{
...
...
@@ -478,7 +478,7 @@ func TestIPNSHostnameBacklinks(t *testing.T) {
s
=
string
(
body
)
t
.
Logf
(
"body: %s
\n
"
,
string
(
body
))
if
!
strings
.
Contains
(
s
,
"Index of /
good-prefix
"
)
{
if
!
strings
.
Contains
(
s
,
"Index of /
ipns/example.net
"
)
{
t
.
Fatalf
(
"expected a path in directory listing"
)
}
if
!
strings
.
Contains
(
s
,
"<a href=
\"
/good-prefix/
\"
>"
)
{
...
...
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