question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Copy & paste post title can cause special chars in slug

See original GitHub issue

When a post is created and the title is being copied and pasted from another source, some special chars e.g. control chars or whitespaces, are included in the slug. Ghost can’t handle those and returns a 404 for the requested post.

Those special chars (e. g. 0x08) need to be stripped out from the title & slug.

Example:

DB: slug: kp-video-unofficial-201 title: 201柯文哲 北市長選舉非官方競選影片

Visible on site: slug: kp-video-unofficial-2018%08 title: 2018�柯文哲台�北市長選舉非官方競選影片

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
kevinansfieldcommented, Dec 6, 2018

If you’re on macOS it’s possible to replicate by using the Character Viewer (https://stackoverflow.com/a/4946245/1163866 - slightly different on recent macOS versions but the principle is the same) to insert the control characters.

0reactions
nazcommented, Jan 2, 2019

@kirrg001 I think the problem with these characters in titles/content might surface when we try serving them in XML (for example as a part of sitemaps). Would need to investigate this specific use-case, but I remember that’s the place I had a problem at.

The original issue is fixed, so I think it could be closed. We’d raise a new one if XML suspicion is confirmed 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

custom post types - Slug Formatting : Acceptable Characters?
No, forward slashes are not allowed to be used in slugs. However, they are automatically stripped out when trying to include slashes in...
Read more >
Strange Characters added in my URL - WordPress.org
I have to create a new post, copy paste the content from the weird URL post into ... I'm afraid that could be...
Read more >
Symbol "<" (Less-than sign) in the title cuts all further text in slug
Symbol "<" in the title, shouldn't cut all further text in slug. This symbol should only be excluded, (replaced with delimiter, etc).
Read more >
Create a slug that accepts certain characters for blog url
Please how do I create a slug for my php blog with a function that will accept only alphanumerics,inverted commas,commas,full stop,colon,empty ...
Read more >
Permalinks & Slugs – WordPress.com Support
A slug will be different when the title contains certain characters, like spaces or currency symbols, as well as anything else that isn't...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found