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
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]>
  • Loading branch information
wojtekmaj authored Nov 19, 2024
1 parent c5345f5 commit 842e2ac
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 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,8 @@ 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 842e2ac

Please sign in to comment.