From 47a15d7a9af208c08ae7071291f7aa8fe5b06e43 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Fri, 13 Mar 2026 23:42:01 +0000 Subject: [PATCH] fix: tighten package tag coverage --- src/infra/package-tag.test.ts | 1 + src/infra/package-tag.ts | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/infra/package-tag.test.ts b/src/infra/package-tag.test.ts index 794acf63093..c50237e5fd3 100644 --- a/src/infra/package-tag.test.ts +++ b/src/infra/package-tag.test.ts @@ -12,6 +12,7 @@ describe("normalizePackageTagInput", () => { it("strips known package-name prefixes before returning the tag", () => { expect(normalizePackageTagInput("openclaw@beta", packageNames)).toBe("beta"); expect(normalizePackageTagInput("@openclaw/plugin@2026.2.24", packageNames)).toBe("2026.2.24"); + expect(normalizePackageTagInput("openclaw@ ", packageNames)).toBeNull(); }); it("returns trimmed raw values when no package prefix matches", () => { diff --git a/src/infra/package-tag.ts b/src/infra/package-tag.ts index 105afeb769c..c98bac5bbd5 100644 --- a/src/infra/package-tag.ts +++ b/src/infra/package-tag.ts @@ -10,7 +10,8 @@ export function normalizePackageTagInput( for (const packageName of packageNames) { const prefix = `${packageName}@`; if (trimmed.startsWith(prefix)) { - return trimmed.slice(prefix.length); + const tag = trimmed.slice(prefix.length).trim(); + return tag ? tag : null; } }