Skip to content

Commit

Permalink
fix 500 when edit hook (#8782) (#8790)
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny authored and techknowlogick committed Nov 2, 2019
1 parent f104898 commit 4a08d57
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions modules/git/hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ func (h *Hook) Update() error {
h.IsActive = false
return nil
}
d := filepath.Dir(h.path)
if err := os.MkdirAll(d, os.ModePerm); err != nil {
return err
}

err := ioutil.WriteFile(h.path, []byte(strings.Replace(h.Content, "\r", "", -1)), os.ModePerm)
if err != nil {
return err
Expand Down

0 comments on commit 4a08d57

Please sign in to comment.