Monorepo for Tangled tangled.org
2

Configure Feed

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

appview/repo: fix file-too-large bug

Signed-off-by: oppiliappan <me@oppi.li>

author
oppiliappan
committer
Seongmin Lee
date (Jun 17, 2026, 10:09 PM +0900) commit d2071613 parent a0d38138 change-id ypmwozln
+7 -9
+7 -9
appview/repo/blob.go
··· 143 143 }, nil 144 144 } 145 145 146 - // skip large blobs 147 - if blobResp.ContentLength > maxBlobSize || blobResp.ContentLength < 0 { 146 + content, err := io.ReadAll(io.LimitReader(blobResp.Body, maxBlobSize+1)) 147 + if err != nil { 148 + return models.BlobView{}, err 149 + } 150 + 151 + if int64(len(content)) > maxBlobSize { 148 152 return models.BlobView{ 149 153 ContentType: contentType, 150 154 ContentSrc: blobUrl, ··· 153 157 }, nil 154 158 } 155 159 156 - // just in case, check the size again 157 - content, err := io.ReadAll(io.LimitReader(blobResp.Body, maxBlobSize)) 158 - if err != nil { 159 - return models.BlobView{}, err 160 - } 161 - 162 160 contentStr := string(content) 163 161 return models.BlobView{ 164 162 ContentType: contentType, ··· 166 164 Contents: contentStr, 167 165 FileTooLarge: false, 168 166 Lines: countLines(contentStr), 169 - SizeHint: uint64(max(blobResp.ContentLength, 0)), 167 + SizeHint: uint64(len(content)), 170 168 }, nil 171 169 }() 172 170 if err != nil {