Skip to content

Commit

Permalink
fix: download button pointing to an incorrect binary on Windows arm64 (
Browse files Browse the repository at this point in the history
…#7240)

* Fix Download button pointing to an incorrect binary on Windows arm64

Closes #7239 

This PR changes the way DownloadButton calculates `bitness` which gets passed to `getNodeDownloadUrl`. 

Previously, this value was passed directly from `useDetectOS()` without any further processing, leading to the issue mentioned above.

After this change, `bitness` is calculated similarly to how it's done in `BitnessDropdown`, so: by passing `architecture` and `bitness` to `getUserBitnessByArchitecture`:

https://github.com/nodejs/nodejs.org/blob/c5345f551ea545cf9d04017204b17f3099940ada/apps/site/components/Downloads/Release/BitnessDropdown.tsx#L16-L29

Signed-off-by: Wojciech Maj <[email protected]>

* Fix formatting

---------

Signed-off-by: Wojciech Maj <[email protected]>
  • Loading branch information
wojtekmaj authored Nov 19, 2024
1 parent 52e04b0 commit 6be3b25
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion apps/site/components/Downloads/DownloadButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import Button from '@/components/Common/Button';
import { useDetectOS } from '@/hooks';
import type { NodeRelease } from '@/types';
import { getNodeDownloadUrl } from '@/util/getNodeDownloadUrl';
import { getUserBitnessByArchitecture } from '@/util/getUserBitnessByArchitecture';

import styles from './index.module.css';

Expand All @@ -17,7 +18,12 @@ const DownloadButton: FC<PropsWithChildren<DownloadButtonProps>> = ({
release: { versionWithPrefix },
children,
}) => {
const { os, bitness } = useDetectOS();
const {
os,
bitness: userBitness,
architecture: userArchitecture,
} = useDetectOS();
const bitness = getUserBitnessByArchitecture(userArchitecture, userBitness);
const downloadLink = getNodeDownloadUrl(versionWithPrefix, os, bitness);

return (
Expand Down

0 comments on commit 6be3b25

Please sign in to comment.