refactor: drop two unmaintained dependencies, rename the byte size helpers (#39083)

This commit is contained in:
silverwind
2026-08-27 15:31:20 +00:00
committed by GitHub
parent 3b6ce586a7
commit 66c672d0b7
33 changed files with 197 additions and 180 deletions
+2 -2
View File
@@ -34,7 +34,7 @@
{{ctx.Locale.Tr "repo.diff.file_image_height"}}: <span class="text bounds-info-height"></span>
&nbsp;|&nbsp;
</span>
{{ctx.Locale.Tr "repo.diff.file_byte_size"}}: <span class="text">{{FileSize .file.LeftBlobSize}}</span>
{{ctx.Locale.Tr "repo.diff.file_byte_size"}}: <span class="text">{{FormatByteSize .file.LeftBlobSize}}</span>
</p>
</span>
{{end}}
@@ -49,7 +49,7 @@
{{ctx.Locale.Tr "repo.diff.file_image_height"}}: <span class="text bounds-info-height"></span>
&nbsp;|&nbsp;
</span>
{{ctx.Locale.Tr "repo.diff.file_byte_size"}}: <span class="text">{{FileSize .file.RightBlobSize}}</span>
{{ctx.Locale.Tr "repo.diff.file_byte_size"}}: <span class="text">{{FormatByteSize .file.RightBlobSize}}</span>
</p>
</span>
{{end}}
+1 -1
View File
@@ -11,7 +11,7 @@
{{end}}
{{if ne .FileSize nil}}
<div class="file-info-entry">
<span class="file-info-size">{{FileSize .FileSize}}</span>{{if .IsLFSFile}}<span class="ui label">LFS</span>{{end}}
<span class="file-info-size">{{FormatByteSize .FileSize}}</span>{{if .IsLFSFile}}<span class="ui label">LFS</span>{{end}}
</div>
{{end}}
{{if .LFSLock}}
+1 -1
View File
@@ -65,7 +65,7 @@
</a>
{{end}}
<div class="flex-text-block muted" {{if not (eq .Repository.Size 0)}}data-tooltip-content="{{.Repository.SizeDetailsString}}"{{end}}>
{{$fileSizeFormatted := FileSize .Repository.Size}}{{/* the formatted string is always "{val} {unit}" */}}
{{$fileSizeFormatted := FormatByteSize .Repository.Size}}{{/* the formatted string is always "{val} {unit}" */}}
{{$fileSizeFields := StringUtils.Split $fileSizeFormatted " "}}
{{svg "octicon-database"}} <b>{{ctx.Locale.PrettyNumber (index $fileSizeFields 0)}}</b> {{index $fileSizeFields 1}}
</div>
@@ -19,7 +19,7 @@
</a>
</div>
<div class="flex-text-block tw-p-2">
<span class="ui tw-text-text-light">{{.Size | FileSize}}</span>
<span class="ui tw-text-text-light">{{.Size | FormatByteSize}}</span>
</div>
</div>
{{end -}}
+1 -1
View File
@@ -84,7 +84,7 @@
<strong class="flex-text-inline">{{svg "octicon-package" 16 "download-icon"}}<span class="gt-ellipsis">{{$att.Name}}</span></strong>
</a>
<div class="attachment-right-info flex-text-inline">
<span class="tw-pl-5">{{$att.Size | FileSize}}</span>
<span class="tw-pl-5">{{$att.Size | FormatByteSize}}</span>
<span class="flex-text-inline" data-tooltip-content="{{ctx.Locale.Tr "repo.release.download_count" (ctx.Locale.PrettyNumber $att.DownloadCount)}}">
{{svg "octicon-info"}}
</span>
+1 -1
View File
@@ -82,7 +82,7 @@
<div class="flex-text-block tw-flex-1">
<input name="attachment-edit-{{.UUID}}" class="tw-max-w-[48em]" required value="{{.Name}}">
<input name="attachment-del-{{.UUID}}" type="hidden" value="false">
<span class="tw-text-text-light tw-flex-shrink-0">{{.Size | FileSize}}</span>
<span class="tw-text-text-light tw-flex-shrink-0">{{.Size | FormatByteSize}}</span>
<span data-tooltip-content="{{ctx.Locale.Tr "repo.release.download_count" (ctx.Locale.PrettyNumber .DownloadCount)}}">
{{svg "octicon-info"}}
</span>
+1 -1
View File
@@ -16,7 +16,7 @@
{{ShortSha .Oid}}
</a>
</td>
<td>{{FileSize .Size}}</td>
<td>{{FormatByteSize .Size}}</td>
<td>{{DateUtils.TimeSince .CreatedUnix}}</td>
<td class="tw-text-right">
<a class="ui primary button" href="{{$.Link}}/find?oid={{.Oid}}&size={{.Size}}">{{ctx.Locale.Tr "repo.settings.lfs_findcommits"}}</a>
+1 -1
View File
@@ -13,7 +13,7 @@
</div>
<div class="inline field">
<label>{{ctx.Locale.Tr "repo.repo_size"}}</label>
<span {{if not (eq .Repository.Size 0)}} data-tooltip-content="{{.Repository.SizeDetailsString}}"{{end}}>{{FileSize .Repository.Size}}</span>
<span {{if not (eq .Repository.Size 0)}} data-tooltip-content="{{.Repository.SizeDetailsString}}"{{end}}>{{FormatByteSize .Repository.Size}}</span>
</div>
<div class="inline field">
<label>{{ctx.Locale.Tr "repo.template"}}</label>