Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 4.7.2 - Unreleased

### Fixed

- Issue with incorrect warning "Unexpected file name detected" that would appear
for nRF9151 modem firmware files with variant suffixes (for example,
`mfw_nrf9151-ntn_1.0.0-1.alpha.zip`).

## 4.7.1 - 2025-12-18

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pc-nrfconnect-programmer",
"version": "4.7.1",
"version": "4.7.2",
"displayName": "Programmer",
"description": "Tool for flash programming Nordic SoCs and SiPs",
"homepage": "https://github.com/NordicSemiconductor/pc-nrfconnect-programmer",
Expand Down
19 changes: 11 additions & 8 deletions src/components/ModemUpdateDialogView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ import {
} from '../reducers/modemReducer';
import { WithRequired } from '../util/types';

export const isValidNrf9160FirmwareName = (filename: string | undefined) =>
!filename || /mfw_nrf9160_\d+\.\d+\.\d+.*.zip/.test(filename);

export const isValidNrf91x1FirmwareName = (filename: string | undefined) =>
!filename ||
/mfw_nrf91x1_\d+\.\d+\.\d+.*.zip/.test(filename) ||
/mfw.*nrf91.1(-\w+)?_\d+\.\d+\.\d+.*.zip/.test(filename);

const ModemUpdateDialogView = () => {
const abortController = useRef(new AbortController());
const [progress, setProgress] =
Expand Down Expand Up @@ -61,17 +69,12 @@ const ModemUpdateDialogView = () => {

if (is9160) {
expectedFileName = 'mfw_nrf9160_X.X.X*.zip';
expectedFwName =
!modemFwName || /mfw_nrf9160_\d+\.\d+\.\d+.*.zip/.test(modemFwName);
expectedFwName = isValidNrf9160FirmwareName(modemFwName);
url =
'https://www.nordicsemi.com/Products/Development-hardware/nrf9160-dk/download#infotabs';
} else if (is91x1) {
expectedFileName = 'mfw_nrf91x1_X.X.X*.zip';
expectedFwName =
!modemFwName ||
/mfw_nrf91x1_\d+\.\d+\.\d+.*.zip/.test(modemFwName) ||
// DECT mfw
/mfw.*nrf91.1_\d+\.\d+\.\d+\.zip/.test(modemFwName);
expectedFileName = 'mfw_nrf91?1*_X.X.X*.zip';
expectedFwName = isValidNrf91x1FirmwareName(modemFwName);
url = 'https://www.nordicsemi.com/Products/nRF9161/Download';
}

Expand Down
103 changes: 103 additions & 0 deletions src/components/__tests__/ModemUpdateDialogView-test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
/*
* Copyright (c) 2026 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-Nordic-4-Clause
*/

import {
isValidNrf91x1FirmwareName,
isValidNrf9160FirmwareName,
} from '../ModemUpdateDialogView';

describe('Modem firmware filename validation', () => {
describe('nRF9160 firmware names', () => {
it('accepts names from https://www.nordicsemi.com/Products/nRF9160/Download', () => {
expect(isValidNrf9160FirmwareName('mfw_nrf9160_1.1.0.zip')).toBe(
true,
);
expect(isValidNrf9160FirmwareName('mfw_nrf9160_1.3.7.zip')).toBe(
true,
);
});

it('accepts undefined as valid (no file selected)', () => {
expect(isValidNrf9160FirmwareName(undefined)).toBe(true);
});

describe('invalid names', () => {
it('rejects wrong prefix', () => {
expect(isValidNrf9160FirmwareName('fw_nrf9160_1.0.0.zip')).toBe(
false,
);
});

it('rejects non-zip file', () => {
expect(
isValidNrf9160FirmwareName('mfw_nrf9160_1.1.0.tar'),
).toBe(false);
});

it('rejects nRF91x1 firmware names', () => {
expect(
isValidNrf9160FirmwareName('mfw_nrf91x1_2.0.4.zip'),
).toBe(false);
expect(
isValidNrf9160FirmwareName('mfw-pti_nrf91x1_2.3.8.zip'),
).toBe(false);
});
});
});

describe('nRF91x1 firmware names', () => {
it('accepts names from https://www.nordicsemi.com/Products/nRF9161/Download', () => {
expect(isValidNrf91x1FirmwareName('mfw_nrf91x1_2.0.0.zip')).toBe(
true,
);
expect(isValidNrf91x1FirmwareName('mfw_nrf91x1_2.0.4.zip')).toBe(
true,
);
expect(
isValidNrf91x1FirmwareName('mfw-pti_nrf91x1_2.3.1.zip'),
).toBe(true);
expect(
isValidNrf91x1FirmwareName('mfw-pti_nrf91x1_2.3.8.zip'),
).toBe(true);
});

it('DECT names from https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/getting-started-with-nr-phy', () => {
expect(
isValidNrf91x1FirmwareName('mfw-nr+_nrf91x1_1.0.0.zip'),
).toBe(true);
});

it('accepts names from https://www.nordicsemi.com/Products/nRF9151/Download', () => {
expect(
isValidNrf91x1FirmwareName('mfw_nrf9151-ntn_1.0.0-1.alpha.zip'),
).toBe(true);
});

it('accepts undefined as valid (no file selected)', () => {
expect(isValidNrf91x1FirmwareName(undefined)).toBe(true);
});

describe('invalid names', () => {
it('rejects wrong prefix', () => {
expect(isValidNrf91x1FirmwareName('fw_nrf91x1_2.0.0.zip')).toBe(
false,
);
});

it('rejects non-zip file', () => {
expect(
isValidNrf91x1FirmwareName('mfw_nrf91x1_2.0.0.tar'),
).toBe(false);
});

it('rejects nRF9160 firmware names', () => {
expect(
isValidNrf91x1FirmwareName('mfw_nrf9160_1.1.0.zip'),
).toBe(false);
});
});
});
});