Page MenuHomePhabricator

Can't navigate to phriction page with apostrophe in title
Closed, ResolvedPublic

Description

I had a phriction page on my install titled Johns' Toys. After updating this past Sunday, I am unable to navigate to the page. When hovering, in the phriction hierarchy, the link shows as /w/category/ppl/johns'_toys/, but upon click, the apostrophe gets stripped out and I end up at /w/category/johns_toys/, which then 404's. Manually placing the apostrophe in the url just causes the same.

Any advice on how to get back to my page?

Let me know if I can provide any more info that would be useful.

Event Timeline

sshannin updated the task description. (Show Details)
sshannin added a project: Phriction.
sshannin added a subscriber: sshannin.

Steps to reproduce would be helpful. I tried to reproduce the error naturally and am unable to. I tried:

  1. Create a page called "Chad's Test"
  2. slug gets created to "chad_s_test"
  3. Document Hierarchy correctly links to "chad_s_test"

I too cannot recreate it.

I suspect there's a chance that the page had to be created before some recent update. It also seems like this depends on the apostrophe being at a word boundary (see fix in task description). In particular, if I make a page titled Chads' Testnow, the apostrophe just gets completely elided from the slug and from the title. My hunch is that it used to not?

I don't have a readily available instance that I can revert to verify this.

epriestley claimed this task.
epriestley added a subscriber: epriestley.

Since we can't reproduce this, I'm not sure how we could fix it.

Your best bet may be to just update the database directly. The slug should be in the slug column in the phabricator_phriction.phriction_document table. Note that they're stored with trailing slashes. If you look at the other values in that column, the proper format should be pretty clear.

There aren't any caches or anything that you need to worry about.

We just did a visual refresh, but this didn't touch anything mechanical about Phriction. Not sure how it might have gotten in that state.

There were some changes to slugs about 6 weeks ago (D14260, D14261, D14287) but I don't think they would have affected this.

I think I see the issue.

In the db, the slug is indeed what is listed in the document hierarchy: category/johns'_toys

When attempting to following that link, the apostrophe gets removed. You can see that even on this install.

For example, consider the valid URL on this install: https://secure.phabricator.com/w/test_page/ Note that even if you add the apostrophe manually into the url (getting https://secure.phabricator.com/w/test'_page/) the apostrophe gets removed when following the link and still gets you to the correct page.

So it seems like the issue is that apostrophes are getting removed when following links even though the slug itself may have it. Does that make sense? I'm not sure if I explained well.

Either way, are you indicating that it is safe to just update the slug in the db to remove the apostrophe?

It's intentional that we normalize the slugs to try to make typing URLs a little more forgiving: For example, if you go to any of these links:

https://secure.phabricator.com/w/test%20page
https://secure.phabricator.com/w/test___page
https://secure.phabricator.com/w/TeSt_pAgE

...you end up in the place you (presumably) wanted to be.

Either way, are you indicating that it is safe to just update the slug in the db to remove the apostrophe?

Yes.

I did indeed update across those 3 revisions you listed; I was previously at October 11.

So it seems like the issue is that I have a non-normalized slug in the db. Is that supposed to be possible? Or is the issue that the db slug itself is not being normalized even though the url is so they end up not matching?

I'm happy to just cut the conversation here if you want btw and fix in db; was just trying to give you more info to get to the bottom of how it happened.

Confirming that removing the apostrophe from the slug in the db did resolve. Thanks.

I will leave it to you to decide whether the slug should never have been placed into the db non-normalized or whether the error was the db slug was not being normalized for comparison (or if you just don't care).

sshannin changed the task status from Invalid to Resolved.Nov 24 2015, 6:38 PM