From 1a4a050062e00e60fb00f82a6ecd3027e81c4056 Mon Sep 17 00:00:00 2001 From: Daniel Silhavy Date: Mon, 11 Nov 2024 09:04:21 +0100 Subject: [PATCH] Fix a bug when iterating over key Ids. Assume that only one of the keyIds need to be usable. --- .../protection/controllers/ProtectionController.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/streaming/protection/controllers/ProtectionController.js b/src/streaming/protection/controllers/ProtectionController.js index 67f04c8d35..89f8772a18 100644 --- a/src/streaming/protection/controllers/ProtectionController.js +++ b/src/streaming/protection/controllers/ProtectionController.js @@ -1163,14 +1163,10 @@ function ProtectionController(config) { return true; } - let usable = true - - normalizedKeyIds.forEach((normalizedKeyId) => { - const keyStatus = keyStatusMap.get(normalizedKeyId) - usable = keyStatus && keyStatus !== ProtectionConstants.MEDIA_KEY_STATUSES.INTERNAL_ERROR && keyStatus !== ProtectionConstants.MEDIA_KEY_STATUSES.OUTPUT_RESTRICTED; - }) - - return usable + return [...normalizedKeyIds].some((normalizedKeyId) => { + const keyStatus = keyStatusMap.get(normalizedKeyId); + return keyStatus && keyStatus !== ProtectionConstants.MEDIA_KEY_STATUSES.INTERNAL_ERROR && keyStatus !== ProtectionConstants.MEDIA_KEY_STATUSES.OUTPUT_RESTRICTED; + }); } catch (error) { logger.error(error); return true