diff options
author | Bjørn Erik Pedersen <[email protected]> | 2017-12-28 11:32:02 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2017-12-28 11:32:02 +0100 |
commit | 1b0780dbebb912a8e86487fc3573c687e0b5171f (patch) | |
tree | 721e93d54507586a60c5b4c0e8b6e0fc881eb64f /source/fileInfo.go | |
parent | 3cdf19e9b7e46c57a9bb43ff02199177feb55768 (diff) | |
download | hugo-1b0780dbebb912a8e86487fc3573c687e0b5171f.tar.gz hugo-1b0780dbebb912a8e86487fc3573c687e0b5171f.zip |
source: Make sure .File.Dir() ends with a slash
Updates #4190
Diffstat (limited to 'source/fileInfo.go')
-rw-r--r-- | source/fileInfo.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/source/fileInfo.go b/source/fileInfo.go index e4b4a80fb..a20ba27e5 100644 --- a/source/fileInfo.go +++ b/source/fileInfo.go @@ -162,9 +162,12 @@ func (fi *FileInfo) init() { } func (sp *SourceSpec) NewFileInfo(baseDir, filename string, fi os.FileInfo) *FileInfo { + dir, name := filepath.Split(filename) + if !strings.HasSuffix(dir, helpers.FilePathSeparator) { + dir = dir + helpers.FilePathSeparator + } - dir = strings.TrimSuffix(dir, helpers.FilePathSeparator) baseDir = strings.TrimSuffix(baseDir, helpers.FilePathSeparator) relDir := "" |