mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-23 19:47:07 +09:00
Support Editorconfig on web editor
This commit is contained in:
1 parent
47a3243ff1
commit
9ac46fb983
7 files changed
+53
-3
No files matched your search
@@ -45,3 +45,23 @@ func GetArchive(ctx *context.APIContext) {
|
||||
|
||||
repo.Download(ctx.Context)
|
||||
}
|
||||
|
||||
func GetEditorconfig(ctx *context.APIContext) {
|
||||
ec, err := ctx.Repo.GetEditorconfig()
|
||||
if err != nil {
|
||||
if git.IsErrNotExist(err) {
|
||||
ctx.Error(404, "GetEditorconfig", err)
|
||||
} else {
|
||||
ctx.Error(500, "GetEditorconfig", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
fileName := ctx.Params("filename")
|
||||
def := ec.GetDefinitionForFilename(fileName)
|
||||
if def == nil {
|
||||
ctx.Error(404, "GetDefinitionForFilename", err)
|
||||
return
|
||||
}
|
||||
ctx.JSON(200, def)
|
||||
}
|
||||
Reference in new issue
Block a user