Fix paths with dots issue with content adapters

Fixes #12493
This commit is contained in:
Bjørn Erik Pedersen
2024-05-15 11:48:34 +02:00
parent 32c967551b
commit 1aacfced39
3 changed files with 31 additions and 9 deletions

View File

@@ -151,14 +151,6 @@ func (p *PageConfig) Compile(basePath string, pagesFromData bool, ext string, lo
p.Path = path.Join(basePath, p.Path)
}
if pagesFromData {
// Note that NormalizePathStringBasic will make sure that we don't preserve the unnormalized path.
// We do that when we create pages from the file system; mostly for backward compatibility,
// but also because people tend to use use the filename to name their resources (with spaces and all),
// and this isn't relevant when creating resources from an API where it's easy to add textual meta data.
p.Path = paths.NormalizePathStringBasic(p.Path)
}
if p.Content.Markup == "" && p.Content.MediaType == "" {
if ext == "" {
ext = "md"
@@ -190,6 +182,18 @@ func (p *PageConfig) Compile(basePath string, pagesFromData bool, ext string, lo
p.Content.Markup = p.ContentMediaType.SubType
}
if pagesFromData {
if p.Kind == "" {
p.Kind = kinds.KindPage
}
// Note that NormalizePathStringBasic will make sure that we don't preserve the unnormalized path.
// We do that when we create pages from the file system; mostly for backward compatibility,
// but also because people tend to use use the filename to name their resources (with spaces and all),
// and this isn't relevant when creating resources from an API where it's easy to add textual meta data.
p.Path = paths.NormalizePathStringBasic(p.Path)
}
if p.Cascade != nil {
cascade, err := page.DecodeCascade(logger, p.Cascade)
if err != nil {