Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
a1eb9c7d
Commit
a1eb9c7d
authored
Aug 08, 2018
by
Giulio M
Committed by
Balint Gabor
Aug 08, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
swarm/api/http: fixed list leaf links (#17342)
parent
00e6da97
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
6 deletions
+15
-6
server_test.go
swarm/api/http/server_test.go
+3
-3
templates.go
swarm/api/http/templates.go
+12
-3
No files found.
swarm/api/http/server_test.go
View file @
a1eb9c7d
...
...
@@ -576,7 +576,7 @@ func testBzzGetPath(encrypted bool, t *testing.T) {
pageFragments
:
[]
string
{
fmt
.
Sprintf
(
"Swarm index of bzz:/%s/a/"
,
ref
),
`<a class="normal-link" href="b/">b/</a>`
,
`<a class="normal-link" href="a">a</a>`
,
fmt
.
Sprintf
(
`<a class="normal-link" href="/bzz:/%s/a/a">a</a>`
,
ref
)
,
},
},
{
...
...
@@ -584,8 +584,8 @@ func testBzzGetPath(encrypted bool, t *testing.T) {
json
:
`{"entries":[{"hash":"011b4d03dd8c01f1049143cf9c4c817e4b167f1d1b83e5c6f0f10d89ba1e7bce","path":"a/b/b","mod_time":"0001-01-01T00:00:00Z"},{"hash":"011b4d03dd8c01f1049143cf9c4c817e4b167f1d1b83e5c6f0f10d89ba1e7bce","path":"a/b/c","mod_time":"0001-01-01T00:00:00Z"}]}`
,
pageFragments
:
[]
string
{
fmt
.
Sprintf
(
"Swarm index of bzz:/%s/a/b/"
,
ref
),
`<a class="normal-link" href="b">b</a>`
,
`<a class="normal-link" href="c">c</a>`
,
fmt
.
Sprintf
(
`<a class="normal-link" href="/bzz:/%s/a/b/b">b</a>`
,
ref
)
,
fmt
.
Sprintf
(
`<a class="normal-link" href="/bzz:/%s/a/b/c">c</a>`
,
ref
)
,
},
},
{
...
...
swarm/api/http/templates.go
View file @
a1eb9c7d
...
...
@@ -18,6 +18,7 @@ package http
import
(
"encoding/hex"
"fmt"
"html/template"
"path"
...
...
@@ -45,7 +46,10 @@ func init() {
{
templateName
:
"bzz-list"
,
partial
:
bzzList
,
funcs
:
template
.
FuncMap
{
"basename"
:
path
.
Base
},
funcs
:
template
.
FuncMap
{
"basename"
:
path
.
Base
,
"leaflink"
:
leafLink
,
},
},
{
templateName
:
"landing-page"
,
...
...
@@ -62,6 +66,10 @@ func init() {
faviconBytes
=
bytes
}
func
leafLink
(
URI
api
.
URI
,
manifestEntry
api
.
ManifestEntry
)
string
{
return
fmt
.
Sprintf
(
"/bzz:/%s/%s"
,
URI
.
Addr
,
manifestEntry
.
Path
)
}
const
bzzList
=
`{{ define "content" }}
<h3 class="top-space">Swarm index of {{ .URI }}</h3>
<hr>
...
...
@@ -83,10 +91,11 @@ const bzzList = `{{ define "content" }}
<td>DIR</td>
<td>-</td>
</tr>
{{ end }} {{ range .List.Entries }}
{{ end }}
{{ range .List.Entries }}
<tr>
<td>
<a class="normal-link" href="{{
basename .Path
}}">{{ basename .Path }}</a>
<a class="normal-link" href="{{
leaflink $.URI .
}}">{{ basename .Path }}</a>
</td>
<td>{{ .ContentType }}</td>
<td>{{ .Size }}</td>
...
...
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