Skip to content

Commit

Permalink
Page details: Fix displaying slugs with non-latin characters (#51679)
Browse files Browse the repository at this point in the history
* Page details: Fix displaying slug with non-latin characters
  • Loading branch information
carolinan authored Jun 20, 2023
1 parent 0c9301f commit 115e7b1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 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,7 +91,9 @@ export default function SidebarNavigationScreenPage() {
className="edit-site-sidebar-navigation-screen__page-link"
href={ record.link }
>
{ record.link.replace( /^(https?:\/\/)?/, '' ) }
{ filterURLForDisplay(
safeDecodeURIComponent( record.link )
) }
</ExternalLink>
}
content={
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 @@ -42,7 +43,11 @@ function getPageDetails( page ) {
},
{
label: __( 'Slug' ),
value: <Truncate numberOfLines={ 1 }>{ page.slug }</Truncate>,
value: (
<Truncate numberOfLines={ 1 }>
{ safeDecodeURIComponent( page.slug ) }
</Truncate>
),
},
];

Expand Down

0 comments on commit 115e7b1

Please sign in to comment.