Monorepo for Tangled tangled.org
2

Configure Feed

Select the types of activity you want to include in your feed.

appview/repo: use `git.getEntry` output for blob size check

We can't trust `content-length` since blob might be gzipped. use `size`
from `getEntry` output instead.

Signed-off-by: Seongmin Lee <git@boltless.me>

author
Seongmin Lee
committer
Tangled
date (Jun 19, 2026, 1:24 PM +0300) commit 099bdb5b parent 02270a21 change-id mxxvttpu
+10 -13
+10 -13
appview/repo/blob.go
··· 139 139 FileTooLarge: false, 140 140 Contents: "", 141 141 Lines: 0, 142 - SizeHint: uint64(max(blobResp.ContentLength, 0)), 142 + SizeHint: uint64(resp.Size), 143 143 }, nil 144 144 } 145 145 146 146 // skip large blobs 147 - if blobResp.ContentLength > maxBlobSize || blobResp.ContentLength < 0 { 148 - l.Error("large blob:", "ContentLength", blobResp.ContentLength, "maxBlobSize", maxBlobSize) 149 - } 150 - 151 - content, err := io.ReadAll(io.LimitReader(blobResp.Body, maxBlobSize+1)) 152 - if err != nil { 153 - return models.BlobView{}, err 154 - } 155 - 156 - if int64(len(content)) > maxBlobSize { 147 + if resp.Size > maxBlobSize { 157 148 return models.BlobView{ 158 149 ContentType: contentType, 159 150 ContentSrc: blobUrl, 160 151 FileTooLarge: true, 161 - SizeHint: uint64(max(blobResp.ContentLength, 0)), 152 + SizeHint: uint64(resp.Size), 162 153 }, nil 163 154 } 164 155 156 + // just in case, ensure the size again 157 + content, err := io.ReadAll(io.LimitReader(blobResp.Body, maxBlobSize)) 158 + if err != nil { 159 + return models.BlobView{}, err 160 + } 161 + 165 162 contentStr := string(content) 166 163 return models.BlobView{ 167 164 ContentType: contentType, ··· 169 166 Contents: contentStr, 170 167 FileTooLarge: false, 171 168 Lines: countLines(contentStr), 172 - SizeHint: uint64(len(content)), 169 + SizeHint: uint64(resp.Size), 173 170 }, nil 174 171 }() 175 172 if err != nil {