1
1
mirror of https://github.com/go-gitea/gitea synced 2024-06-01 17:05:48 +00:00

fix 500 when edit hook (#8782) (#8789)

This commit is contained in:
Lunny Xiao 2019-11-03 00:41:06 +08:00 committed by Lauris BH
parent 646fd8b570
commit 2236375d66

View File

@ -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