Skip to content

Commit 2236375

Browse files
lunnylafriks
authored andcommitted
fix 500 when edit hook (#8782) (#8789)
1 parent 646fd8b commit 2236375

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

modules/git/hook.go

+5
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ func (h *Hook) Update() error {
9090
h.IsActive = false
9191
return nil
9292
}
93+
d := filepath.Dir(h.path)
94+
if err := os.MkdirAll(d, os.ModePerm); err != nil {
95+
return err
96+
}
97+
9398
err := ioutil.WriteFile(h.path, []byte(strings.Replace(h.Content, "\r", "", -1)), os.ModePerm)
9499
if err != nil {
95100
return err

0 commit comments

Comments
 (0)