2 files changed,
6 insertions(+),
8 deletions(-)
Author:
Oleksandr Smirnov
olexsmir@gmail.com
Committed at:
2026-03-03 19:29:41 +0200
Authored at:
2026-03-03 16:59:18 +0200
Change ID:
pynkkrvzqszznskkpyxsttmoopqntutl
Parent:
0238022
jump to
| M | internal/git/tree.go |
| M | internal/handlers/repo.go |
M
internal/git/tree.go
路路路 73 73 74 74 type FileContent struct { 75 75 IsBinary bool 76 + IsImage bool 76 77 Content []byte 77 78 Mime string 78 79 Size int64 79 80 } 80 81 81 -func (fc FileContent) IsImage() bool { 82 - return strings.HasPrefix(fc.Mime, "image/") 83 -} 84 - 85 82 func (fc *FileContent) String() string { 86 - if fc.IsBinary { 83 + if fc.IsBinary || fc.IsImage { 87 84 return "" 88 85 } 89 86 return string(fc.Content) 路路路 130 127 131 128 return &FileContent{ 132 129 IsBinary: isBin, 130 + IsImage: strings.HasPrefix(mimeType, "image/"), 133 131 Content: content, 134 132 Mime: mimeType, 135 133 Size: file.Size,
M
internal/handlers/repo.go
路路路 205 205 p := RepoFile{ 206 206 Ref: ref, 207 207 Path: treePath, 208 - IsImage: fc.IsImage(), 208 + IsImage: fc.IsImage, 209 209 IsBinary: fc.IsBinary, 210 210 Mime: fc.Mime, 211 211 Size: fc.Size, 路路路 217 217 return 218 218 } 219 219 220 - if !fc.IsImage() && !fc.IsBinary { 220 + if !fc.IsImage && !fc.IsBinary { 221 221 contentStr := fc.String() 222 222 lc, err := countLines(strings.NewReader(contentStr)) 223 223 if err != nil { 路路路 470 470 continue 471 471 } 472 472 473 - if fc.IsBinary { 473 + if fc.IsBinary && fc.IsImage { 474 474 continue 475 475 } 476 476