Skip to content

Commit

Permalink
Fix: wrong link to attachment page when replacing image.
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgefilipecosta committed Dec 5, 2019
1 parent c6643dc commit dd77b4f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/block-library/src/image/edit.js
Expand Up @@ -395,6 +395,12 @@ export class ImageEdit extends Component {
mediaAttributes.href = media.url;
}

// Check if the image is linked to the attachment page.
if ( linkDestination === LINK_DESTINATION_ATTACHMENT ) {
// Update the media link.
mediaAttributes.href = media.link;
}

this.props.setAttributes( {
...mediaAttributes,
...additionalAttributes,
Expand Down

0 comments on commit dd77b4f

Please sign in to comment.