diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2020-05-21 12:25:00 +0300 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2020-05-24 13:35:45 +0300 |
commit | a985efcecf44afe1d252690ec0a00cf077974f44 (patch) | |
tree | 792e19ede943310f091977edb36962d1eee596f9 /hugolib/content_map_test.go | |
parent | 6c3c6686f5d3c7155e2d455b07ac8ab70f42cb88 (diff) |
Fix GetPage on section/bundle name overlaps
In the internal Radix we stored the directory based nodes without a traling slash, e.g. `/blog`.
The original motivation was probably to make it easy to do prefix searching: Give me all ancestors.
This, however have lead to some ambigouty with overlapping directory names.
This particular problem was, however, not possible to work around in an easy way, so from now we store these as `/blog/`.
Fixes #7301
Diffstat (limited to 'hugolib/content_map_test.go')
-rw-r--r-- | hugolib/content_map_test.go | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/hugolib/content_map_test.go b/hugolib/content_map_test.go index 4ddbf8c7f..9ec30201a 100644 --- a/hugolib/content_map_test.go +++ b/hugolib/content_map_test.go @@ -155,19 +155,19 @@ func TestContentMap(t *testing.T) { expect := ` Tree 0: - /blog__hb_/a__hl_ - /blog__hb_/b/c__hl_ + /blog/__hb_a__hl_ + /blog/__hb_b/c__hl_ Tree 1: - /blog + /blog/ Tree 2: - /blog__hb_/a__hl_b/data.json - /blog__hb_/a__hl_logo.png - /blog__hl_sectiondata.json - en/pages/blog__hb_/a__hl_|f:blog/a/index.md + /blog/__hb_a__hl_b/data.json + /blog/__hb_a__hl_logo.png + /blog/__hl_sectiondata.json + en/pages/blog/__hb_a__hl_|f:blog/a/index.md - R: blog/a/b/data.json - R: blog/a/logo.png - en/pages/blog__hb_/b/c__hl_|f:blog/b/c/index.md - en/sections/blog|f:blog/_index.md + en/pages/blog/__hb_b/c__hl_|f:blog/b/c/index.md + en/sections/blog/|f:blog/_index.md - P: blog/a/index.md - P: blog/b/c/index.md - R: blog/sectiondata.json @@ -194,24 +194,24 @@ func TestContentMap(t *testing.T) { expect = ` Tree 0: - /blog__hb_/a__hl_ - /blog__hb_/b/c__hl_ + /blog/__hb_a__hl_ + /blog/__hb_b/c__hl_ Tree 1: - /blog + /blog/ Tree 2: - /blog__hb_/a__hl_b/data.json - /blog__hb_/a__hl_b/data2.json - /blog__hb_/a__hl_logo.png - /blog__hb_/b/c__hl_d/data3.json - /blog__hl_sectiondata.json - /blog__hl_sectiondata2.json - en/pages/blog__hb_/a__hl_|f:blog/a/index.md + /blog/__hb_a__hl_b/data.json + /blog/__hb_a__hl_b/data2.json + /blog/__hb_a__hl_logo.png + /blog/__hb_b/c__hl_d/data3.json + /blog/__hl_sectiondata.json + /blog/__hl_sectiondata2.json + en/pages/blog/__hb_a__hl_|f:blog/a/index.md - R: blog/a/b/data.json - R: blog/a/b/data2.json - R: blog/a/logo.png - en/pages/blog__hb_/b/c__hl_|f:blog/b/c/index.md + en/pages/blog/__hb_b/c__hl_|f:blog/b/c/index.md - R: blog/b/c/d/data3.json - en/sections/blog|f:blog/_index.md + en/sections/blog/|f:blog/_index.md - P: blog/a/index.md - P: blog/b/c/index.md - R: blog/sectiondata.json @@ -226,26 +226,26 @@ func TestContentMap(t *testing.T) { c.Assert(m.testDump(), hqt.IsSameString, ` Tree 0: - /blog__hb_/a__hl_ - /blog__hb_/b/c__hl_ - /blog__hb_/b__hl_ + /blog/__hb_a__hl_ + /blog/__hb_b/c__hl_ + /blog/__hb_b__hl_ Tree 1: - /blog + /blog/ Tree 2: - /blog__hb_/a__hl_b/data.json - /blog__hb_/a__hl_b/data2.json - /blog__hb_/a__hl_logo.png - /blog__hb_/b/c__hl_d/data3.json - /blog__hl_sectiondata.json - /blog__hl_sectiondata2.json - en/pages/blog__hb_/a__hl_|f:blog/a/index.md + /blog/__hb_a__hl_b/data.json + /blog/__hb_a__hl_b/data2.json + /blog/__hb_a__hl_logo.png + /blog/__hb_b/c__hl_d/data3.json + /blog/__hl_sectiondata.json + /blog/__hl_sectiondata2.json + en/pages/blog/__hb_a__hl_|f:blog/a/index.md - R: blog/a/b/data.json - R: blog/a/b/data2.json - R: blog/a/logo.png - en/pages/blog__hb_/b/c__hl_|f:blog/b/c/index.md + en/pages/blog/__hb_b/c__hl_|f:blog/b/c/index.md - R: blog/b/c/d/data3.json - en/pages/blog__hb_/b__hl_|f:blog/b.md - en/sections/blog|f:blog/_index.md + en/pages/blog/__hb_b__hl_|f:blog/b.md + en/sections/blog/|f:blog/_index.md - P: blog/a/index.md - P: blog/b/c/index.md - P: blog/b.md @@ -280,19 +280,19 @@ func TestContentMap(t *testing.T) { c.Assert(got, hqt.IsSameString, ` Tree 0: - /__hb_/bundle__hl_ - /blog__hb_/a__hl_ - /blog__hb_/page__hl_ + /__hb_bundle__hl_ + /blog/__hb_a__hl_ + /blog/__hb_page__hl_ Tree 1: / - /blog + /blog/ Tree 2: - en/pages/__hb_/bundle__hl_|f:bundle/index.md - en/pages/blog__hb_/a__hl_|f:blog/a/index.md - en/pages/blog__hb_/page__hl_|f:blog/page.md + en/pages/__hb_bundle__hl_|f:bundle/index.md + en/pages/blog/__hb_a__hl_|f:blog/a/index.md + en/pages/blog/__hb_page__hl_|f:blog/page.md en/sections/ - P: bundle/index.md - en/sections/blog + en/sections/blog/ - P: blog/a/index.md - P: blog/page.md |