Skip to content

Commit

Permalink
Use utils from the WordPress url package
Browse files Browse the repository at this point in the history
  • Loading branch information
carolinan committed Jun 20, 2023
1 parent 007e493 commit a58045d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { decodeEntities } from '@wordpress/html-entities';
import { pencil } from '@wordpress/icons';
import { __unstableStripHTML as stripHTML } from '@wordpress/dom';
import { escapeAttribute } from '@wordpress/escape-html';
import { safeDecodeURIComponent, filterURLForDisplay } from '@wordpress/url';

/**
* Internal dependencies
Expand Down Expand Up @@ -90,8 +91,8 @@ export default function SidebarNavigationScreenPage() {
className="edit-site-sidebar-navigation-screen__page-link"
href={ record.link }
>
{ decodeURI(
record.link.replace( /^(https?:\/\/)?/, '' )
{ filterURLForDisplay(
safeDecodeURIComponent( record.link )
) }
</ExternalLink>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { count as wordCount } from '@wordpress/wordcount';
import { useSelect } from '@wordpress/data';
import { decodeEntities } from '@wordpress/html-entities';
import { store as coreStore, useEntityRecord } from '@wordpress/core-data';
import { safeDecodeURIComponent } from '@wordpress/url';

/**
* Internal dependencies
Expand Down Expand Up @@ -44,7 +45,7 @@ function getPageDetails( page ) {
label: __( 'Slug' ),
value: (
<Truncate numberOfLines={ 1 }>
{ decodeURI( page.slug ) }
{ safeDecodeURIComponent( page.slug ) }
</Truncate>
),
},
Expand Down

0 comments on commit a58045d

Please sign in to comment.