Browse Source

fix 500 when edit hook (#8782)

tags/v1.21.12.1
Lunny Xiao GitHub 5 years ago
parent
commit
21dfe1b256
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions
  1. +5
    -0
      modules/git/hook.go

+ 5
- 0
modules/git/hook.go 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


Loading…
Cancel
Save