fix: tighten package tag coverage

This commit is contained in:
Peter Steinberger 2026-03-13 23:42:01 +00:00
parent 369032c256
commit 47a15d7a9a
2 changed files with 3 additions and 1 deletions

View File

@ -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", () => {

View File

@ -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;
}
}