mirror of
https://github.com/supabase/supabase.git
synced 2026-06-21 21:12:49 +08:00
Closes #45850. ## Summary `TriggerList`, `EventTriggerList`, and `FunctionList` built cross-links between the database triggers and functions pages by interpolating user-controlled identifiers directly into the URL query string. A function or schema name containing `&`, `=`, `+`, or `#` corrupted the destination filter and routed users to the wrong row. Adds `getDatabaseFunctionsHref` to `TriggerList.utils` (used by both `TriggerList` and `EventTriggerList`) and a new `getDatabaseTriggersHref` in `FunctionList.utils`, both with `encodeURIComponent` wraps. Replaces the three inline interpolations. `FunctionList` only has a single search param (no schema) because the link filters by function name only, so its helper takes one less argument. Same pattern as #45385. ## Test plan Added `TriggerList.utils.test.ts` covering `getDatabaseFunctionsHref` (plain, special chars in name, special chars in schema, both, undefined inputs) and `FunctionList.utils.test.ts` covering `getDatabaseTriggersHref` (plain, special chars in name, plus signs and spaces, undefined inputs). Nine tests total. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Refactor** * Improved database navigation links for functions and triggers by standardizing link generation through centralized utility functions. This ensures consistent URL encoding and parameter handling across the application. * **Tests** * Added comprehensive test coverage for database navigation link utilities, including edge cases with special characters and empty parameters. [](https://app.coderabbit.ai/change-stack/supabase/supabase/pull/45851) <!-- end of auto-generated comment: release notes by coderabbit.ai -->