Files
oak-gpui/crates
Finn Evers f6d4a73c34 terminal: Prevent [] from being sanitized into clickable file link (#20386)
This PR prevents `[]` from being sanitized into an empty string and thus
becoming a "valid", clickable file link in the integrated terminal.


Whenever you type `[]` into the terminal and hover over it while
pressing `cmd`, an empty popup appears and the cursor indicates that
this is a clickable element. Once you click on the brackets, the
worktree root is selected and focused within the file picker.

<img width="87" alt="grafik"
src="https://github.com/user-attachments/assets/01790323-88be-4373-a1ec-a345bcf2521e">


This is because in #2906 support was added for sanititzing file links
like `[/some/path/[slug].tsx]` to `/some/path/[slug].tsx`. In the case
`[]` where an empty string is returned from the sanitation, the string
is considered a valid file path and thus `[]` becomes a valid and
clickable navigation target.

Given that this an edge-case just for this specific one set of brackets
and otherwise no empty strings are matched from the regexes `URL_REGEX`
and `WORD_REGEX`, it seemed that this was the best place to fix this
bug.

Release Notes:

- `[]` is no longer considered a clickable link in the terminal
2024-11-08 02:41:30 +02:00
..
2024-11-01 13:20:30 -04:00
2024-10-27 19:44:21 -07:00
2024-10-24 12:14:03 -06:00
2024-11-06 10:06:25 -07:00
2024-11-06 10:06:25 -07:00
2024-11-06 20:36:59 -07:00
2024-08-13 23:06:07 -07:00
2024-11-06 10:06:25 -07:00
2024-11-06 10:06:25 -07:00
2024-10-26 03:32:22 +03:00
2024-11-01 13:28:34 -06:00
2024-07-15 17:04:15 -06:00
2024-11-06 10:06:25 -07:00
2024-11-06 10:06:25 -07:00
2024-10-02 13:27:16 +02:00
2024-11-07 15:22:53 -05:00
2024-11-06 20:36:59 -07:00
2024-11-06 10:06:25 -07:00
2024-10-30 11:26:54 -06:00