From eecb51ecc121f2a487c5dd3b9b7a036dee5b2090 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Fri, 13 Mar 2026 08:24:36 +0100 Subject: [PATCH] :bug: Fix clipboard getType error when no allowed types found (#8609) When clipboard items have types that don't match the allowed types list, the filtering results in an empty array. Calling getType with undefined throws a NotFoundError. This change adds a check for null/undefined types and filters them from the result. Signed-off-by: Andrey Antukh --- frontend/src/app/util/clipboard.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/frontend/src/app/util/clipboard.js b/frontend/src/app/util/clipboard.js index 0322829e41..742183d0cb 100644 --- a/frontend/src/app/util/clipboard.js +++ b/frontend/src/app/util/clipboard.js @@ -135,7 +135,7 @@ function sortItems(a, b) { export async function fromNavigator(options) { options = options || {}; const items = await navigator.clipboard.read(); - return Promise.all( + const result = await Promise.all( Array.from(items).map(async (item) => { const itemAllowedTypes = Array.from(item.types) .filter(filterAllowedTypes(options)) @@ -155,9 +155,15 @@ export async function fromNavigator(options) { } const type = itemAllowedTypes.at(0); + + if (type == null) { + return null; + } + return item.getType(type); }), ); + return result.filter((item) => !!item); } /**