diff options
author | Lunny Xiao | 2019-11-03 02:31:29 +0800 |
---|---|---|
committer | techknowlogick | 2019-11-02 14:31:29 -0400 |
commit | 4a08d574cf496268b5ceae4fc605e103c870d204 (patch) | |
tree | a033488deca3a8d269e3de0e1f9e110698c5c8ad | |
parent | f1048989898b43be74667be1a73ae535cca548e4 (diff) |
fix 500 when edit hook (#8782) (#8790)
-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 18c00b583..8f72f73f9 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 |