Use LFS object size instead of blob size when viewing a LFS file (#35679) (#35680)

Backport #35679 by surya-purohit

shows the main LFS filesize instead of the pointer filesize when viewing
a file

Co-authored-by: Surya Purohit <suryaprakash.sharma@sourcefuse.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Giteabot
2025-10-16 22:41:24 +08:00
committed by GitHub
parent 18b178e63f
commit f71df88a6b
8 changed files with 18 additions and 13 deletions

View File

@@ -72,6 +72,8 @@ func TestLFSRender(t *testing.T) {
fileInfo := doc.Find("div.file-info-entry").First().Text()
assert.Contains(t, fileInfo, "LFS")
fileSize := doc.Find("div.file-info-entry > .file-info-size").Text()
assert.Equal(t, "2.0 KiB", fileSize)
// find new file view container
fileViewContainer := doc.Find("[data-global-init=initRepoFileView]")

View File

@@ -257,10 +257,12 @@ func testViewFileInRepo(t *testing.T) {
description := htmlDoc.doc.Find(".repo-description")
repoTopics := htmlDoc.doc.Find("#repo-topics")
repoSummary := htmlDoc.doc.Find(".repository-summary")
fileSize := htmlDoc.Find("div.file-info-entry > .file-info-size").Text()
assert.Equal(t, 0, description.Length())
assert.Equal(t, 0, repoTopics.Length())
assert.Equal(t, 0, repoSummary.Length())
assert.Equal(t, "30 B", fileSize)
}
// TestBlameFileInRepo repo description, topics and summary should not be displayed when running blame on a file