0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-12-25 22:14:36 +01:00

fix 500 when edit hook (#8782)

This commit is contained in:
Lunny Xiao 2019-11-02 21:38:11 +08:00 committed by GitHub
parent 232340f5e3
commit 21dfe1b256
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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