feat: show the absolute path every time
Even for dnslink websites. fixes https://github.com/ipfs/go-ipfs/issues/7205
Steven Allen committed
Apr 26, 2020 at 16:11 UTC
46ae021733e825cb46c915518897816b191c60ef
2 files changed
+4
-4
core/corehttp/gateway_handler.go
+1
-1
@@ -335,7 +335,7 @@ func (i *gatewayHandler) getOrHeadHandler(w http.ResponseWriter, r *http.Request
335
// See comment above where originalUrlPath is declared.
336
tplData := listingTemplateData{
337
Listing: dirListing,
338
- Path: originalUrlPath,
338
+ Path: urlPath,
339
BackLink: backLink,
340
Hash: hash,
341
}
core/corehttp/gateway_test.go
+3
-3
@@ -378,7 +378,7 @@ func TestIPNSHostnameBacklinks(t *testing.T) {
378
s := string(body)
379
t.Logf("body: %s\n", string(body))
380
381
- if !strings.Contains(s, "Index of /foo? #<'/") {
381
+ if !strings.Contains(s, "Index of /ipns/example.net/foo? #<'/") {
382
t.Fatalf("expected a path in directory listing")
383
}
384
if !strings.Contains(s, "<a href=\"/foo%3F%20%23%3C%27/./..\">") {
@@ -444,7 +444,7 @@ func TestIPNSHostnameBacklinks(t *testing.T) {
444
s = string(body)
445
t.Logf("body: %s\n", string(body))
446
447
- if !strings.Contains(s, "Index of /foo? #<'/bar/") {
447
+ if !strings.Contains(s, "Index of /ipns/example.net/foo? #<'/bar/") {
448
t.Fatalf("expected a path in directory listing")
449
}
450
if !strings.Contains(s, "<a href=\"/foo%3F%20%23%3C%27/bar/./..\">") {
@@ -478,7 +478,7 @@ func TestIPNSHostnameBacklinks(t *testing.T) {
478
s = string(body)
479
t.Logf("body: %s\n", string(body))
480
481
- if !strings.Contains(s, "Index of /good-prefix") {
481
+ if !strings.Contains(s, "Index of /ipns/example.net") {
482
t.Fatalf("expected a path in directory listing")
483
}
484
if !strings.Contains(s, "<a href=\"/good-prefix/\">") {