1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-12-12 13:30:26 +00:00

Fix new hyphae not creating

This commit is contained in:
Timur Ismagilov 2021-06-16 02:00:29 +05:00
parent d27a63d375
commit 14cb00a6fc

View File

@ -64,14 +64,11 @@ func UploadBinary(h *hyphae.Hypha, mime string, file multipart.File, u *user.Use
// uploadHelp is a helper function for UploadText and UploadBinary // uploadHelp is a helper function for UploadText and UploadBinary
func uploadHelp(h *hyphae.Hypha, hop *history.HistoryOp, ext string, data []byte, u *user.User) (*history.HistoryOp, string) { func uploadHelp(h *hyphae.Hypha, hop *history.HistoryOp, ext string, data []byte, u *user.User) (*history.HistoryOp, string) {
var ( var (
fullPath, err = filepath.EvalSymlinks(filepath.Join(cfg.WikiGitDir, h.Name+ext)) fullPath = filepath.Join(cfg.WikiGitDir, h.Name+ext)
originalFullPath = &h.TextPath originalFullPath = &h.TextPath
) )
if err != nil {
return hop.WithErrAbort(err), err.Error()
}
if !strings.HasPrefix(fullPath, cfg.WikiGitDir) { // If the path somehow got outside the wiki dir if !strings.HasPrefix(fullPath, cfg.WikiGitDir) { // If the path somehow got outside the wiki dir
err = errors.New("bad path") err := errors.New("bad path")
return hop.WithErrAbort(err), err.Error() return hop.WithErrAbort(err), err.Error()
} }
if hop.Type == history.TypeEditBinary { if hop.Type == history.TypeEditBinary {