From 17b53ee8ed17910e2711dd2be8c66e548936b08f Mon Sep 17 00:00:00 2001 From: "Sharad." Date: Sun, 13 Sep 2026 08:26:56 +0000 Subject: [PATCH] fix: show macOS download sizes using decimal megabytes Use 1,000-byte megabytes for macOS assets so the Download page matches Finder and GitHub release sizes (e.g. ~430 MB instead of ~410 MB). Fixes processing/processing-website#644 Co-authored-by: Sharad. --- src/hooks/download.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/hooks/download.js b/src/hooks/download.js index 8c5495fe..19d57022 100644 --- a/src/hooks/download.js +++ b/src/hooks/download.js @@ -35,10 +35,10 @@ const getTooltip = (name, intProvider) => { }; // Adapted from https://stackoverflow.com/q/15900485 -function formatBytes(bytes, decimals = 0) { +function formatBytes(bytes, decimals = 0, unitBase = 1024) { if (!+bytes) return '0 Bytes'; - const k = 1024; + const k = unitBase; const dm = decimals < 0 ? 0 : decimals; const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; @@ -84,12 +84,13 @@ export const usePreparedReleases = (releases) => { asset.downloadUrl = "https://snapcraft.io/install/processing/raspbian" } } + const os = getOS(asset.name); item.assets.push({ name: asset.name, - os: getOS(asset.name), + os, bit: getBit(asset.name), url: asset.downloadUrl, - size: formatBytes(asset.size), + size: formatBytes(asset.size, 0, os === 'macOS' ? 1000 : 1024), tooltipMessage: getTooltip(asset.name, (id) => intl.formatMessage({ id }) )