mirror of
https://github.com/gohugoio/hugo.git
synced 2024-12-01 15:49:11 -05:00
Use filepath.Join in locale resource getting
This commit is contained in:
parent
8d8e9dde51
commit
0586bf0dc3
1 changed files with 1 additions and 9 deletions
|
@ -158,15 +158,7 @@ func resGetRemote(url string, fs afero.Fs, hc *http.Client) ([]byte, error) {
|
||||||
|
|
||||||
// resGetLocal loads the content of a local file
|
// resGetLocal loads the content of a local file
|
||||||
func resGetLocal(url string, fs afero.Fs) ([]byte, error) {
|
func resGetLocal(url string, fs afero.Fs) ([]byte, error) {
|
||||||
p := ""
|
filename := filepath.Join(viper.GetString("WorkingDir"), url)
|
||||||
workingDir := viper.GetString("WorkingDir")
|
|
||||||
if workingDir != "" {
|
|
||||||
p = workingDir
|
|
||||||
if !strings.HasSuffix(p, helpers.FilePathSeparator) {
|
|
||||||
p = p + helpers.FilePathSeparator
|
|
||||||
}
|
|
||||||
}
|
|
||||||
filename := p + url
|
|
||||||
if e, err := helpers.Exists(filename, fs); !e {
|
if e, err := helpers.Exists(filename, fs); !e {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue