mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-21 21:35:28 +02:00
Fix page names that contain dot
changes: - in hugolib/page.go, `func permalink` and `func TargetPath` Fixed the attempt to *replace* the extension of something that was *already* a basename. - in source/file.go, `func NewFile` added check for allowed languages before translating filename Fixes #2555
This commit is contained in:
committed by
Bjørn Erik Pedersen
parent
cda3b36fe2
commit
186db7cd7a
@@ -126,11 +126,14 @@ func NewFile(relpath string) *File {
|
||||
f.ext = strings.TrimPrefix(filepath.Ext(f.LogicalName()), ".")
|
||||
f.baseName = helpers.Filename(f.LogicalName())
|
||||
|
||||
f.lang = strings.TrimPrefix(filepath.Ext(f.baseName), ".")
|
||||
if f.lang == "" {
|
||||
lang := strings.TrimPrefix(filepath.Ext(f.baseName), ".")
|
||||
if _, ok := viper.GetStringMap("languages")[lang]; lang == "" || !ok {
|
||||
f.lang = viper.GetString("defaultContentLanguage")
|
||||
f.translationBaseName = f.baseName
|
||||
} else {
|
||||
f.lang = lang
|
||||
f.translationBaseName = helpers.Filename(f.baseName)
|
||||
}
|
||||
f.translationBaseName = helpers.Filename(f.baseName)
|
||||
|
||||
f.section = helpers.GuessSection(f.Dir())
|
||||
f.uniqueID = helpers.Md5String(f.LogicalName())
|
||||
|
Reference in New Issue
Block a user