Unverified Commit ffe35df8 authored by Steven Allen's avatar Steven Allen Committed by GitHub

Merge pull request #7219 from ipfs/fix/listing-header

feat(gateway): show the absolute path and CID every time
parents 4847083a 46ae0217
......@@ -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: originalUrlPath,
Path: urlPath,
BackLink: backLink,
Hash: hash,
}
......
......@@ -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? #&lt;&#39;/bar/") {
if !strings.Contains(s, "Index of /ipns/example.net/foo? #&lt;&#39;/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/\">") {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment