Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function URLs in terminal end with zero width space causing a click to open an invalid URL #4311

Closed
Soviut opened this issue Feb 16, 2022 · 1 comment · Fixed by #4456
Closed

Comments

@Soviut
Copy link

Soviut commented Feb 16, 2022

Describe the bug

When starting netlify dev, all loaded functions are listed with their URLs. These URLs are clickable in most terminals.

◈ Netlify Dev ◈
◈ Ignored general context env var: LANG (defined in process)
◈ Injected .env file env var: VITE_API_URL
◈ Loaded function api (​http://localhost:8888/.netlify/functions/api​).
◈ Loaded function render (​http://localhost:8888/.netlify/functions/render​).
◈ Functions server is listening on 41863
◈ Starting Netlify Dev with Vite

These URLs have an invisible "zero width space" (U+200B) character at the end. Even that snippet above has the characters! (copy that snippet into a text editor and use the arrow keys to move the cursor left and right between api and )).
Clicking or copying the URL from the terminal to visit it produces a URL that looks like

http://localhost:8888/.netlify/functions/api%E2%80%8B

To Reproduce

Steps to reproduce the behavior:

  1. Create a project with a function.
  2. Run netlify dev.
  3. Click or copy the function URL that is listed.
  4. Notice the additional characters at the end of the URL.

Configuration

N/A

Expected behavior

Function URLs should be clickable/copyable without the additional character(s).

Additional context

I checked the source and the character doesn't exist in where the line is logged here.

It seems to be a fallback feature that the terminal-link package adds so that certain terminals wouldn't include the ) close paren in the URL.

sindresorhus/terminal-link#11

There is an option to disable the fallback.

@jackiewmacharia
Copy link
Contributor

Workaround for this is to pass the format we'd like terminal-link to use to a fallback function allowing us to bypass the zero width space. e.g terminalLink(text, url, { fallback: () => `${text} ${url}` }).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants