WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 6 months ago

#16496 closed defect (bug) (fixed)

Make $sample_permalink_html human-readable on Edit Post screen

Reported by: linuxologos Owned by: johnbillion
Milestone: 4.1 Priority: normal
Severity: normal Version: 2.5
Component: Administration Keywords: has-patch commit
Focuses: administration Cc:

Description

If the permalink contains words with non-latin characters (for example the permalink structure is /%category%/%postname%/ and the assigned category is non-English) the $sample_permalink_html, which is echoed by edit-form-advanced.php, is not human readable on Edit Post screen (below the title). The editable part of the permalink (the one that comes from the title of the post) is readable.

$sample_permalink_html should be urldecoded at some stage before echoed.

Screenshot attached.

Attachments (5)

sample_permalink_html.PNG (21.6 KB) - added by linuxologos 4 years ago.
sample_permalink_html-urldecoded.PNG (15.3 KB) - added by linuxologos 4 years ago.
Same permalink, urldecoded.
16496.patch (806 bytes) - added by linuxologos 4 years ago.
16496.2.patch (473 bytes) - added by linuxologos 4 years ago.
16496.3.patch (717 bytes) - added by johnbillion 6 months ago.

Download all attachments as: .zip

Change History (12)

@linuxologos4 years ago

Same permalink, urldecoded.

comment:1 follow-up: @scribu4 years ago

  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to Future Release

That is actually the URL you would get if you were to copy/paste from the browser's location bar.

I was going to say that we should try to fix the slug sanitization, but since all letters can be non-ascii, like in the screenshot, we should fix this instead.

Version 0, edited 4 years ago by scribu (next)

comment:2 @SergeyBiryukov4 years ago

Also, when using an IDN domain, sample permalink displays it in Punycode. It should be human-readable too.

comment:3 in reply to: ↑ 1 @SergeyBiryukov4 years ago

Replying to scribu:

That is actually the text you would get if you were to copy/paste from the browser's location bar.

In Opera and Safari an URL is copied in human-readable form.

@linuxologos4 years ago

@linuxologos4 years ago

comment:4 @linuxologos4 years ago

  • Keywords has-patch added; needs-patch removed

16496.patch urldecodes $sample_permalink_html upon definition.
16496.2.patch urldecodes $sample_permalink_html just before being echoed.

The latter can affect the Shortlink part and may not be desirable.

A third solution would be to alter the get_sample_permalink_html() function in wp-admin/includes/post.php, but it doesn't sound as the best solution.

The local $sample_permalink_html in wp-admin/edit-form-advanced.php is definitely intended to be printed on screen, so it can and should be human-readable.

comment:5 @chriscct77 months ago

  • Component changed from Formatting to Administration
  • Keywords reporter-feedback added

Seems to work for me.
@linuxologos is this still broken for you in WordPress 4.0?

@johnbillion6 months ago

comment:6 @johnbillion6 months ago

  • Focuses administration added
  • Keywords commit added; reporter-feedback removed
  • Milestone changed from Future Release to 4.1
  • Type changed from enhancement to defect (bug)
  • Version set to 2.5

This is still an issue. It doesn't affect the post slug, just the rest of the permalink (eg. a when using a permastructure which includes the category name, and the post is in a category with punycode in its slug).

16496.3.patch urldecodes the permalink in the most appropriate place.

comment:7 @johnbillion6 months ago

  • Owner set to johnbillion
  • Resolution set to fixed
  • Status changed from new to closed

In 30364:

Decode the sample permalink shown to the user. This avoids showing encoded non-Latin characters in the sample permalink.

Fixes #16496
Props linuxologos

Note: See TracTickets for help on using tickets.