SDA-4242: Local will take prio if invalid value inserted into HKCU (#1906)

This commit is contained in:
NguyenTranHoangSym 2023-07-21 15:40:07 +07:00 committed by GitHub
parent 695db74438
commit bd48b69345
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,5 @@
import { logger } from '../common/logger';
import { RegistryStore } from './stores/registry-store';
import { EChannelRegistry, RegistryStore } from './stores/registry-store';
enum RegistryValueType {
REG_SZ = 'REG_SZ',
@ -44,7 +44,12 @@ export const retrieveWindowsRegistry = async (): Promise<string> => {
return new Promise((resolve) => {
regKeyUser.get(CHANNEL_KEY, (error, channel) => {
if (error || !channel) {
if (
error ||
![EChannelRegistry.BETA, EChannelRegistry.LATEST].includes(
channel?.value,
)
) {
logger.error('registry-handler: error occurred. Details: ', error);
regKeyLocal.get(CHANNEL_KEY, (err, localChannel) => {