Foundation.mozilla.org: 馃尅 URL encoding funkiness for buyer's guide

Created on 5 Feb 2019  路  3Comments  路  Source: mozilla/foundation.mozilla.org

I copied a URL from my browser and pasted it into Slack, only to discover it wasn't working:

https://foundation.mofostaging.net/en/privacynotincluded/categories/Valentine%E2%80%99s%20Day/

The correct link is
https://foundation.mofostaging.net/en/privacynotincluded/categories/Valentine's%20Day/

The trick here is that somewhere along the way, the apostrophe got converted into a "smart apostrophe" (That's probably the wrong word. It's the curly kind.)

Given that this is going to start being shared narrowly tomorrow and broadly in the following few days, what's the best thing we can do to make sure we don't have users stumbling on this and getting 404's? Can we easily sanitize the string that generates the category URL to strip that character altogether (thus making the url /categories/Valentines%20Day)? Or should we simply catch it with a redirect in the CMS admin for now?

@patjouk @cadecairos @Pomax @mmmavis

Buyer's Guide 馃泹 bug

All 3 comments

Remember that this isn't technically Wagtail-managed at all, it's a plain Django app, so we're currently beholden to whatever Django does. We're creating the actual link over in https://github.com/mozilla/foundation.mozilla.org/blob/master/network-api/networkapi/buyersguide/templates/category_nav_links.html#L5-L6, so one thing we can probably do here is use a sluggifying tag to make the url itself look normal, with an unsluggifier on the views.py side to make sure that the right category gets served up.

Yeah, I just added that.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

taisdesouzalessa picture taisdesouzalessa  路  5Comments

kristinashu picture kristinashu  路  3Comments

xmatthewx picture xmatthewx  路  3Comments

kristinashu picture kristinashu  路  5Comments

xmatthewx picture xmatthewx  路  4Comments