Editorconfig not respected in PR Conversation view #10931

Open
opened 2025-11-02 09:22:29 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @silverwind on GitHub (May 29, 2023).

Description

Tab size preference from .editorconfig is not working in the conversation tab:

https://try.gitea.io/silverwind/symlink-test/pulls/11

image

It is working in the Files tab:

https://try.gitea.io/silverwind/symlink-test/pulls/11/files

image

I traced it to templates/repo/issue/view_content/comments.tmpl line 521:

{{TabSizeClass $.Editorconfig $file.Name}}

$.Editorconfig is nil here, so TabSizeClass incorrectly returns the default tab size of 8. Maybe someone familiar around these parts sees the fix, for me it at least is not obvious.

Gitea Version

main

Can you reproduce the bug on the Gitea demo site?

Yes

Originally created by @silverwind on GitHub (May 29, 2023). ### Description Tab size preference from `.editorconfig` is not working in the conversation tab: https://try.gitea.io/silverwind/symlink-test/pulls/11 <img width="780" alt="image" src="https://github.com/go-gitea/gitea/assets/115237/d6e29a8f-56c0-4154-b909-60a07aad2415"> It is working in the Files tab: https://try.gitea.io/silverwind/symlink-test/pulls/11/files <img width="304" alt="image" src="https://github.com/go-gitea/gitea/assets/115237/d98b2249-2902-46ba-82ef-a8f9eee6b28a"> I traced it to `templates/repo/issue/view_content/comments.tmpl` line 521: ```handlebars {{TabSizeClass $.Editorconfig $file.Name}} ``` `$.Editorconfig` is nil here, so `TabSizeClass` incorrectly returns the default tab size of 8. Maybe someone familiar around these parts sees the fix, for me it at least is not obvious. ### Gitea Version main ### Can you reproduce the bug on the Gitea demo site? Yes
GiteaMirror added the topic/uitype/bug labels 2025-11-02 09:22:29 -06:00
Author
Owner

@wxiaoguang commented on GitHub (Aug 8, 2023):

The Editorconfig is injected by a middleware SetEditorconfigIfExists. I guess the middleware is not correctly called.

@wxiaoguang commented on GitHub (Aug 8, 2023): The `Editorconfig` is injected by a middleware `SetEditorconfigIfExists`. I guess the middleware is not correctly called.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#10931