-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Page details: Fix displaying slugs with non-latin characters #51679
Conversation
{ decodeURI( | ||
record.link.replace( /^(https?:\/\/)?/, '' ) | ||
) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the core uses the safeDecodeURIComponent
from the url
package, in other places for similar fixes. We can also replace the regex here with filterURLForDisplay
.
{ filterURLForDisplay( safeDecodeURIComponent( record.link ) ) }
Edit: I found my PR that fixes a similar bug in post editor - #42930.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, I did not know these existed.
value: <Truncate numberOfLines={ 1 }>{ page.slug }</Truncate>, | ||
value: ( | ||
<Truncate numberOfLines={ 1 }> | ||
{ decodeURI( page.slug ) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, but just safeDecodeURIComponent
.
Size Change: +12 B (0%) Total Size: 1.4 MB
ℹ️ View Unchanged
|
Flaky tests detected in a58045d. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5319665259
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works as expected. Tested with Georgian language.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…ss#51679) * Page details: Fix displaying slug with non-latin characters
What?
If a page has a title and slug with non-latin characters, the page details show them as encoded:
The Slug /επίπεδο-2/ shows as %ce%b5%cf%80%ce%af%cf%80%ce%b5%ce%b4%ce%bf-2.
This PR decodes the visual presentation of the slug in two places in the page details:
The page link at the top below the page title, and the page slug item that is further down the list.
Closes #51676
Why?
The text was not displayed correctly.
How?
Decodes the URI and slug.
Testing Instructions
Привет, мир
Testing Instructions for Keyboard
Привет, мир
Screenshots or screencast
After: