diff --git a/src/domain/deb/debPackage.ts b/src/domain/deb/debPackage.ts index 12075e9831e..17540148df4 100644 --- a/src/domain/deb/debPackage.ts +++ b/src/domain/deb/debPackage.ts @@ -366,19 +366,14 @@ export const parseDebianDependency = ( countWhitespaceTokens(inner, maxArchitectureItems) > maxArchitectureItems ) return null; - const tokens = inner - .trim() - .split(/\s+/u) - .filter((token) => token.length > 0); - if (tokens.length === 0) return null; - const negated = tokens.every((token) => token.startsWith("!")); - const mixed = tokens.some((token) => token.startsWith("!")) !== negated; - if (mixed) return null; + const text = inner.trim(); + if (text === "") return null; + const tokens = text.split(/\s+/u); + const negated = text.startsWith("!"); + if (tokens.some((token) => token.startsWith("!") !== negated)) return null; arch_restriction = { negated, - architectures: tokens.map((token) => - token.startsWith("!") ? token.slice(1) : token, - ), + architectures: negated ? tokens.map((token) => token.slice(1)) : tokens, }; rest = rest.slice(close + 1).trim(); }