Skip to content

Image blocks with www links append the site's base URL to the link.  #35910

@Robertght

Description

@Robertght

Description

This is a replica of this report Automattic/wp-calypso#57305


Quick summary

If you add a link to an image in Gutenberg with the www prefix, the link will appear on the live site with the base URL of the WordPress site appended to the link address.

What you expected to happen

The link should follow the same behaviour as links added in paragraph blocks: The www. site should be linked correctly.

What actually happened

The link 404's as the base wordpress site URL is appended to the beginning of the link.

Context

Operating System

macOS

Browser

Mozilla Firefox

Theme-specific issue?

No response

Other notes

No response

Reproducibility

Consistent

Severity

All

Available workarounds?

Yes, easy to implement

Workaround details

Removing the link from the image block, and then re-adding it as https://www.link.com will work.

Removing the image block and re-adding it may be necessary.

Step-by-step reproduction instructions

  1. Create an image block in the editor. Link it as so (www.speedtest.net is used as an example here):

Image Link Bug Simple Link Cap

2. Go into preview or the live site, and hover over the image:

Link Bug end result

3. Clicking the link will result in a 404 error on the wordpress site, as it tries to go to: https://wordpress-site/www.speedtest.net

Screenshots, screen recording, code snippet

No response

Environment info

  • WordPress 5.8.1
  • Gutenberg 11.7.1

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

Yes

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

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Block] GalleryAffects the Gallery Block - used to display groups of images[Block] ImageAffects the Image Block[Type] BugAn existing feature does not function as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions