gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

Linking text containing a colon breaks the URL

Open ProLeadsOnline opened this issue 6 months ago • 4 comments

Description

When creating a link where the linked text itself contains a colon (:), WordPress incorrectly interprets the text after the colon as part of the URL.

Expected behavior: The linked text should remain unchanged, while the URL should only contain the actual hyperlink target.

Actual behavior: WordPress incorrectly includes the text after the colon in the generated link, resulting in malformed URLs.

Step-by-step reproduction instructions

Steps to reproduce: 1.Create or edit a post/page. 2.Add a hyperlink. 3.Use linked text containing a colon, for example:

Example:text

4.Insert a normal HTTPS URL.

Screenshots, screen recording, code snippet

Image

Environment info

  • WordPress 7.0, Gutenberg:
  • Chrome Browser 146.0.7680.178 (Offizieller Build) (arm64)

Please confirm that you have searched existing issues in the repo.

  • [x] Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

  • [x] Yes

Please confirm which theme type you used for testing.

  • [ ] Block
  • [ ] Classic
  • [ ] Hybrid (e.g. classic with theme.json)
  • [x] Not sure

ProLeadsOnline avatar Jun 05 '26 11:06 ProLeadsOnline

@ProLeadsOnline, It seems that feature is not provided by Gutenberg. The icon is different.

Image

The default link icon looks like this.

Image

Is any plugin overriding the default link functionality? Can you reproduce the issue with all plugins disabled?

t-hamano avatar Jun 05 '26 12:06 t-hamano

This appears to have been addressed in #32301 (fixed via #32663), however I was able to reproduce the issue on the 23.3.0-rc.1 version. Looking into it further.

https://github.com/user-attachments/assets/8660425f-81e8-4561-ab9d-39019933831d

Image Image

vedant-ere avatar Jun 05 '26 13:06 vedant-ere

WordPress incorrectly includes the text after the colon in the generated link, resulting in malformed URLs.

I don't think this as a bug. scheme-colon-path is a standard URI scheme: https://en.wikipedia.org/wiki/List_of_URI_schemes

hanneslsm avatar Jun 05 '26 15:06 hanneslsm

Agree, this isn't a bug - the colon is supported purposely as there are a number of URI schemes (official and unofficial) that use it (mailto: and tel: being the most common). I'll close this.

talldan avatar Jun 08 '26 02:06 talldan