mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-14 05:52:43 +00:00
Use graceful editorconfig loader to reduce errors when loading malformed editorconfigs (#21257)
The _graceful_ should fail less when the `.editorconfig` file isn't properly written, e.g. boolean values from YAML or unparseable numbers (when a number is expected). As is... information is lost as the _warning_ (a go-multierror.Error) is ignored. If anybody knows how to send them to the UI as warning; any help is appreciated. Closes #20694 Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
This commit is contained in:
parent
797babbfcb
commit
9b416b2e36
7 changed files with 30 additions and 20 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue