aboutsummaryrefslogtreecommitdiffstats
path: root/routers/repo/editor.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/repo/editor.go')
-rw-r--r--routers/repo/editor.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/routers/repo/editor.go b/routers/repo/editor.go
index b5bb2f0ce3..4314218bf3 100644
--- a/routers/repo/editor.go
+++ b/routers/repo/editor.go
@@ -95,11 +95,12 @@ func editFile(ctx *context.Context, isNewFile bool) {
return
}
- dataRc, err := blob.Data()
+ dataRc, err := blob.DataAsync()
if err != nil {
ctx.NotFound("blob.Data", err)
return
}
+ defer dataRc.Close()
ctx.Data["FileSize"] = blob.Size()
ctx.Data["FileName"] = blob.Name()
@@ -251,9 +252,9 @@ func editFilePost(ctx *context.Context, form auth.EditRepoFileForm, isNewFile bo
} else if models.IsErrRepoFileAlreadyExists(err) {
ctx.Data["Err_TreePath"] = true
ctx.RenderWithErr(ctx.Tr("repo.editor.file_already_exists", form.TreePath), tplEditFile, &form)
- } else if models.IsErrBranchNotExist(err) {
+ } else if git.IsErrBranchNotExist(err) {
// For when a user adds/updates a file to a branch that no longer exists
- if branchErr, ok := err.(models.ErrBranchNotExist); ok {
+ if branchErr, ok := err.(git.ErrBranchNotExist); ok {
ctx.RenderWithErr(ctx.Tr("repo.editor.branch_does_not_exist", branchErr.Name), tplEditFile, &form)
} else {
ctx.Error(500, err.Error())
@@ -417,9 +418,9 @@ func DeleteFilePost(ctx *context.Context, form auth.DeleteRepoFileForm) {
} else {
ctx.ServerError("DeleteRepoFile", err)
}
- } else if models.IsErrBranchNotExist(err) {
+ } else if git.IsErrBranchNotExist(err) {
// For when a user deletes a file to a branch that no longer exists
- if branchErr, ok := err.(models.ErrBranchNotExist); ok {
+ if branchErr, ok := err.(git.ErrBranchNotExist); ok {
ctx.RenderWithErr(ctx.Tr("repo.editor.branch_does_not_exist", branchErr.Name), tplEditFile, &form)
} else {
ctx.Error(500, err.Error())