Skip to content

Commit 0f71fa4

Browse files
committed
fix: maybe failed to sync config #1118
1 parent b5414d8 commit 0f71fa4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

internal/config/save.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package config
22

33
import (
44
"os"
5+
"path/filepath"
56

67
"github.com/0xJacky/Nginx-UI/internal/helper"
78
"github.com/0xJacky/Nginx-UI/internal/nginx"
@@ -15,6 +16,7 @@ func Save(absPath string, content string, cfg *model.Config) (err error) {
1516
if cfg == nil {
1617
cfg, err = q.Assign(field.Attrs(&model.Config{
1718
Filepath: absPath,
19+
Name: filepath.Base(absPath),
1820
})).Where(q.Filepath.Eq(absPath)).FirstOrCreate()
1921
if err != nil {
2022
return
@@ -24,7 +26,7 @@ func Save(absPath string, content string, cfg *model.Config) (err error) {
2426
if !helper.IsUnderDirectory(absPath, nginx.GetConfPath()) {
2527
return ErrPathIsNotUnderTheNginxConfDir
2628
}
27-
29+
2830
err = CheckAndCreateHistory(absPath, content)
2931
if err != nil {
3032
return

0 commit comments

Comments
 (0)