feat(region): fix ISO size display (#23095)

SGuestcdrom.Size is Byte, not MB
This commit is contained in:
happy-game
2025-08-20 12:08:16 +08:00
committed by GitHub
parent cd51076bc6
commit f7b40ac941
+3 -1
View File
@@ -136,7 +136,9 @@ func (self *SGuestcdrom) GetImage() (*SCachedimage, error) {
func (self *SGuestcdrom) GetDetails() string {
if len(self.ImageId) > 0 {
if self.Size > 0 {
return fmt.Sprintf("%s(%s/%dMB)", self.Name, self.ImageId, self.Size)
// Size is stored in bytes, convert to MB for display
sizeMB := self.Size / 1024 / 1024
return fmt.Sprintf("%s(%s/%dMB)", self.Name, self.ImageId, sizeMB)
} else {
return fmt.Sprintf("%s(inserting)", self.ImageId)
}