diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2019-11-02 21:38:11 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-02 21:38:11 +0800 |
commit | 21dfe1b2567f666789a09c2b38114f389ebac30d (patch) | |
tree | 7e3bcaef95d48cb9ff92fb54e1cb65979e744986 /modules/git/hook.go | |
parent | 232340f5e3ebe61787021bebea01fd755513c72b (diff) | |
download | gitea-21dfe1b2567f666789a09c2b38114f389ebac30d.tar.gz gitea-21dfe1b2567f666789a09c2b38114f389ebac30d.zip |
fix 500 when edit hook (#8782)
Diffstat (limited to 'modules/git/hook.go')
-rw-r--r-- | modules/git/hook.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/git/hook.go b/modules/git/hook.go index e966591668..245c6b92ce 100644 --- a/modules/git/hook.go +++ b/modules/git/hook.go @@ -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 |