Skip to content

Commit 46ae021

Browse files
committed
feat: show the absolute path every time
Even for dnslink websites. fixes #7205
1 parent d8bc5c9 commit 46ae021

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

core/corehttp/gateway_handler.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ func (i *gatewayHandler) getOrHeadHandler(w http.ResponseWriter, r *http.Request
335335
// See comment above where originalUrlPath is declared.
336336
tplData := listingTemplateData{
337337
Listing: dirListing,
338-
Path: originalUrlPath,
338+
Path: urlPath,
339339
BackLink: backLink,
340340
Hash: hash,
341341
}

core/corehttp/gateway_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ func TestIPNSHostnameBacklinks(t *testing.T) {
378378
s := string(body)
379379
t.Logf("body: %s\n", string(body))
380380

381-
if !strings.Contains(s, "Index of /foo? #<'/") {
381+
if !strings.Contains(s, "Index of /ipns/example.net/foo? #<'/") {
382382
t.Fatalf("expected a path in directory listing")
383383
}
384384
if !strings.Contains(s, "<a href=\"/foo%3F%20%23%3C%27/./..\">") {
@@ -444,7 +444,7 @@ func TestIPNSHostnameBacklinks(t *testing.T) {
444444
s = string(body)
445445
t.Logf("body: %s\n", string(body))
446446

447-
if !strings.Contains(s, "Index of /foo? #&lt;&#39;/bar/") {
447+
if !strings.Contains(s, "Index of /ipns/example.net/foo? #&lt;&#39;/bar/") {
448448
t.Fatalf("expected a path in directory listing")
449449
}
450450
if !strings.Contains(s, "<a href=\"/foo%3F%20%23%3C%27/bar/./..\">") {
@@ -478,7 +478,7 @@ func TestIPNSHostnameBacklinks(t *testing.T) {
478478
s = string(body)
479479
t.Logf("body: %s\n", string(body))
480480

481-
if !strings.Contains(s, "Index of /good-prefix") {
481+
if !strings.Contains(s, "Index of /ipns/example.net") {
482482
t.Fatalf("expected a path in directory listing")
483483
}
484484
if !strings.Contains(s, "<a href=\"/good-prefix/\">") {

0 commit comments

Comments
 (0)