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) <noreply@anthropic.com>
This commit is contained in:
bincxzandClaude committed 2026-01-28 19:16:02 +08:00
1 parent 2fb82e1cb7
commit 58ccd4bfb9
1 file changed
+5
+5
View File
@@ -257,6 +257,11 @@ const SnippetsManager: React.FC<SnippetsManagerProps> = ({
// 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());