-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Fix material icon & diff highlight #33844
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
ffae59a to
4570cdd
Compare
f3a1752 to
4697a79
Compare
4697a79 to
0e12b7c
Compare
f9465b4 to
f4a4f33
Compare
(cherry picked from commit 657239b)
|
Next: Fix file icon mapping #33855 |
* giteaofficial/main: Fix various Fomantic UI and htmx problems (go-gitea#33851) Add workflow_job webhook (go-gitea#33694) Fix file icon mapping (go-gitea#33855) Drop fomantic build (go-gitea#33845) Fix auto concurrency cancellation skips commit status updates (go-gitea#33764) Fix test code (go-gitea#33829) Remove "noscript" tag from html head (go-gitea#33846) Fix material icon & diff highlight (go-gitea#33844) Fix LFS URL (go-gitea#33840) Add material icons for file list (go-gitea#33837)
|
There is a regression caused #35504 |
I used git bisect to identify the issue, and it points to this PR. When I check out commit 657239b, I can reproduce the bug. However, checking out the previous commit, c102492, everything works correctly. |
diff --git a/services/gitdiff/gitdiff.go b/services/gitdiff/gitdiff.go
index 6e15f71609..1a82c7fb7f 100644
--- a/services/gitdiff/gitdiff.go
+++ b/services/gitdiff/gitdiff.go
@@ -1337,6 +1337,7 @@ func GetDiffForRender(ctx context.Context, repoLink string, gitRepo *git.Reposit
}
func highlightCodeLines(diffFile *DiffFile, isLeft bool, content string) map[int]template.HTML {
+ content, _ = charset.ToUTF8(util.UnsafeStringToBytes(content), charset.ConvertOpts{KeepBOM: false})
highlightedNewContent, _ := highlight.Code(diffFile.Name, diffFile.Language, content)
splitLines := strings.Split(string(highlightedNewContent), "\n")
lines := make(map[int]template.HTML, len(splitLines))Can you try this? |
Looks like it works |




No description provided.