From 1d951cfc4915d9beb12b9e2e9fcd178069e4ce02 Mon Sep 17 00:00:00 2001 From: Andrey Nering Date: Wed, 1 Feb 2017 10:21:03 -0200 Subject: Fix 500 when repo has invalid .editorconfig (#3758) Creating a notice instead Fixes #3643 --- routers/repo/pull.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'routers/repo/pull.go') diff --git a/routers/repo/pull.go b/routers/repo/pull.go index fe606010..d649e3d7 100644 --- a/routers/repo/pull.go +++ b/routers/repo/pull.go @@ -357,12 +357,10 @@ func ViewPullFiles(ctx *context.Context) { return } - ec, err := ctx.Repo.GetEditorconfig() - if err != nil && !git.IsErrNotExist(err) { - ctx.Handle(500, "ErrGettingEditorconfig", err) + setEditorconfigIfExists(ctx) + if ctx.Written() { return } - ctx.Data["Editorconfig"] = ec headTarget := path.Join(pull.HeadUserName, pull.HeadRepo.Name) ctx.Data["IsSplitStyle"] = ctx.Query("style") == "split" @@ -616,12 +614,10 @@ func CompareAndPullRequest(ctx *context.Context) { } } - ec, err := ctx.Repo.GetEditorconfig() - if err != nil && !git.IsErrNotExist(err) { - ctx.Handle(500, "ErrGettingEditorconfig", err) + setEditorconfigIfExists(ctx) + if ctx.Written() { return } - ctx.Data["Editorconfig"] = ec ctx.HTML(200, COMPARE_PULL) } -- cgit v1.2.3