Skip to content

Commit e0066da

Browse files
committed
bring size calculation fix
1 parent 4e5248c commit e0066da

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

vueapp/components/Videos/Actions/VideoDownloadItem.vue

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,20 +64,20 @@ export default {
6464
getMediaText(media) {
6565
var text = media?.info || '';
6666
text = text.replace(' * ', ' x ');
67-
var size = parseInt(media?.size, 10) || 0;
67+
var size = media?.size || 0;
68+
6869
if (size == 0) {
6970
return text;
7071
}
7172
72-
let kbtobytes = 1024;
73-
let mbtobytes = 1000 * kbtobytes;
73+
size = size / 1024;
7474
75-
if (size >= mbtobytes) {
76-
let megabytes = (size / mbtobytes).toFixed(1);
77-
text = text + ' (' + megabytes + ' MB)'
75+
if (size > 1024) {
76+
size = Math.round(size/1024 * 10) / 10
77+
text = text + ' (' + size + ' MB)'
7878
} else {
79-
let kilobytes = (size / kbtobytes).toFixed(1);
80-
text = text + ' (' + kilobytes + ' KB)'
79+
size = Math.round(size * 10) / 10
80+
text = text + ' (' + size + ' KB)'
8181
}
8282
8383
return text

0 commit comments

Comments
 (0)