mirror of
https://github.com/tiennm99/hugoDocs.git
synced 2026-10-13 14:16:06 +00:00
Use filepath.Join in locale resource getting
This commit is contained in:
1 parent
8d8e9dde51
commit
0586bf0dc3
1 file changed
+1
-9
@@ -158,15 +158,7 @@ func resGetRemote(url string, fs afero.Fs, hc *http.Client) ([]byte, error) {
|
||||
|
||||
// resGetLocal loads the content of a local file
|
||||
func resGetLocal(url string, fs afero.Fs) ([]byte, error) {
|
||||
p := ""
|
||||
workingDir := viper.GetString("WorkingDir")
|
||||
if workingDir != "" {
|
||||
p = workingDir
|
||||
if !strings.HasSuffix(p, helpers.FilePathSeparator) {
|
||||
p = p + helpers.FilePathSeparator
|
||||
}
|
||||
}
|
||||
filename := p + url
|
||||
filename := filepath.Join(viper.GetString("WorkingDir"), url)
|
||||
if e, err := helpers.Exists(filename, fs); !e {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user