From a6e16911cc94ff683003fc52d4f60644eb3d8c06 Mon Sep 17 00:00:00 2001 From: Alireza Gholiei Date: Wed, 15 Oct 2025 17:50:28 -0700 Subject: [PATCH] fix(template): use path.Join and rename param to avoid Windows embed path issue (#1391) --- internal/template/template.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/internal/template/template.go b/internal/template/template.go index 1d75d82b..552b12b4 100644 --- a/internal/template/template.go +++ b/internal/template/template.go @@ -3,6 +3,7 @@ package template import ( "bufio" "bytes" + "github.com/0xJacky/Nginx-UI/internal/nginx" "github.com/0xJacky/Nginx-UI/settings" templ "github.com/0xJacky/Nginx-UI/template" @@ -12,8 +13,9 @@ import ( "github.com/tufanbarisyildirim/gonginx/parser" "github.com/uozi-tech/cosy/logger" cSettings "github.com/uozi-tech/cosy/settings" + "io" - "path/filepath" + dirPath "path" "strings" "text/template" ) @@ -39,7 +41,7 @@ func GetTemplateInfo(path, name string) (configListItem ConfigInfoItem) { Filename: name, } - file, err := templ.DistFS.Open(filepath.Join(path, name)) + file, err := templ.DistFS.Open(dirPath.Join(path, name)) if err != nil { logger.Error(err) return @@ -83,7 +85,7 @@ type ConfigDetail struct { } func ParseTemplate(path, name string, bindData map[string]Variable) (c ConfigDetail, err error) { - file, err := templ.DistFS.Open(filepath.Join(path, name)) + file, err := templ.DistFS.Open(dirPath.Join(path, name)) if err != nil { err = errors.Wrap(err, "error tokenized template") return