summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
Diffstat (limited to 'routers')
-rw-r--r--routers/api/v1/repo/file.go2
-rw-r--r--routers/web/repo/editor.go2
-rw-r--r--routers/web/repo/middlewares.go2
-rw-r--r--routers/web/repo/view.go13
4 files changed, 13 insertions, 6 deletions
diff --git a/routers/api/v1/repo/file.go b/routers/api/v1/repo/file.go
index d5e8924f5d..5f7ed255bc 100644
--- a/routers/api/v1/repo/file.go
+++ b/routers/api/v1/repo/file.go
@@ -381,7 +381,7 @@ func GetEditorconfig(ctx *context.APIContext) {
// "404":
// "$ref": "#/responses/notFound"
- ec, err := ctx.Repo.GetEditorconfig(ctx.Repo.Commit)
+ ec, _, err := ctx.Repo.GetEditorconfig(ctx.Repo.Commit)
if err != nil {
if git.IsErrNotExist(err) {
ctx.NotFound(err)
diff --git a/routers/web/repo/editor.go b/routers/web/repo/editor.go
index f65e1ad3d8..476c1d5ddd 100644
--- a/routers/web/repo/editor.go
+++ b/routers/web/repo/editor.go
@@ -165,7 +165,7 @@ func editFile(ctx *context.Context, isNewFile bool) {
// GetEditorConfig returns a editorconfig JSON string for given treePath or "null"
func GetEditorConfig(ctx *context.Context, treePath string) string {
- ec, err := ctx.Repo.GetEditorconfig()
+ ec, _, err := ctx.Repo.GetEditorconfig()
if err == nil {
def, err := ec.GetDefinitionForFilename(treePath)
if err == nil {
diff --git a/routers/web/repo/middlewares.go b/routers/web/repo/middlewares.go
index 9a4aa3382c..5c38b31154 100644
--- a/routers/web/repo/middlewares.go
+++ b/routers/web/repo/middlewares.go
@@ -19,7 +19,7 @@ func SetEditorconfigIfExists(ctx *context.Context) {
return
}
- ec, err := ctx.Repo.GetEditorconfig()
+ ec, _, err := ctx.Repo.GetEditorconfig()
if err != nil && !git.IsErrNotExist(err) {
description := fmt.Sprintf("Error while getting .editorconfig file: %v", err)
diff --git a/routers/web/repo/view.go b/routers/web/repo/view.go
index ce60d91150..2a57f8ef37 100644
--- a/routers/web/repo/view.go
+++ b/routers/web/repo/view.go
@@ -346,11 +346,18 @@ func renderFile(ctx *context.Context, entry *git.TreeEntry, treeLink, rawLink st
ctx.Data["RawFileLink"] = rawLink + "/" + util.PathEscapeSegments(ctx.Repo.TreePath)
if ctx.Repo.TreePath == ".editorconfig" {
- _, editorconfigErr := ctx.Repo.GetEditorconfig(ctx.Repo.Commit)
- ctx.Data["FileError"] = editorconfigErr
+ _, editorconfigWarning, editorconfigErr := ctx.Repo.GetEditorconfig(ctx.Repo.Commit)
+ if editorconfigWarning != nil {
+ ctx.Data["FileWarning"] = strings.TrimSpace(editorconfigWarning.Error())
+ }
+ if editorconfigErr != nil {
+ ctx.Data["FileError"] = strings.TrimSpace(editorconfigErr.Error())
+ }
} else if ctx.Repo.IsIssueConfig(ctx.Repo.TreePath) {
_, issueConfigErr := ctx.Repo.GetIssueConfig(ctx.Repo.TreePath, ctx.Repo.Commit)
- ctx.Data["FileError"] = issueConfigErr
+ if issueConfigErr != nil {
+ ctx.Data["FileError"] = strings.TrimSpace(issueConfigErr.Error())
+ }
}
isDisplayingSource := ctx.FormString("display") == "source"