From 58ccd4bfb94ea254db0f4e34f7dc2be5ee1f7c83 Mon Sep 17 00:00:00 2001 From: bincxz <16399091+binaricat@users.noreply.github.com> Date: Wed, 28 Jan 2026 19:16:02 +0800 Subject: [PATCH] fix(snippets): normalize trailing slashes in package paths Strip trailing slashes before saving package paths to ensure consistent path handling across the UI. This prevents issues where 'foo/' would not match 'foo' in the package browser. Co-Authored-By: Claude (gemini-claude-opus-4-5-thinking) --- components/SnippetsManager.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/components/SnippetsManager.tsx b/components/SnippetsManager.tsx index cae8ecd22..2b585a9ef 100644 --- a/components/SnippetsManager.tsx +++ b/components/SnippetsManager.tsx @@ -257,6 +257,11 @@ const SnippetsManager: React.FC = ({ // At root level, preserve the leading slash if user intended it full = name; } + + // Strip trailing slash to ensure consistent path handling + if (full.endsWith('/')) { + full = full.slice(0, -1); + } // Check for duplicate package names (case-insensitive) const existingPackage = packages.find(p => p.toLowerCase() === full.toLowerCase());