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

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

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Surya Purohit
2025-10-16 15:12:54 +05:30
committed by GitHub
parent 990201dc93
commit bf8ecf7c93
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