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
This commit is contained in:
Bjørn Erik Pedersen
2020-05-21 11:25:00 +02:00
parent 6c3c6686f5
commit a985efcecf
10 changed files with 212 additions and 163 deletions

View File

@@ -665,3 +665,12 @@ func FileContainsAny(filename string, subslices [][]byte, fs afero.Fs) (bool, er
func Exists(path string, fs afero.Fs) (bool, error) {
return afero.Exists(fs, path)
}
// AddTrailingSlash adds a trailing Unix styled slash (/) if not already
// there.
func AddTrailingSlash(path string) string {
if !strings.HasSuffix(path, "/") {
path += "/"
}
return path
}