Topic with Japanese in URL doesn't redirect if URL doesn't perfectly match

Does that mean that when people switch from encoded to ascii it doesn’t regenerate the slugs? If so it seems like the one time process you wrote to clear the slugs wouldn’t work for those cases.

1 Like

Hello,

The pull did not fix the issue completely. If the slug contains a + sign, it will show the 400 error.
To confirm this, I have switched back to “None” for slug generation, edited the title and removed the + sign from title and switched back to “encoded” it fixed the 400 error.

The scenario is when a title includes a plus sign, it returns 400 error. (There could be other characters that could lead to this. I only tested the + sign)

Thank you

5 Likes

Is that on a topic slug or in a category slug?

4 Likes

A topic slug. Didn’t try on the categories.

3 Likes

The encoded slug generator strips all + signs so I have no idea how you get that:

https://github.com/discourse/discourse/blob/master/lib/slug.rb#L51

Just tested locally and they are removed just fine for me.

3 Likes

Perhaps the scenario is different on your local.
My website language is Persian. Can you switch to Persian and then test?

To duplicate this, create a topic with the following subject:
گربه های ایرانی + از نژاد خوبی برخوردار هستند

My slug turns to an unreadable format and returns a 400 error:

https://domain.ltd/t/%D8%A7%DA%A9%D8%A7%D9%86%D8%AA-%D9%BE%D8%B1%D9%85%DB%8C%D9%88%D9%85-%D9%88%D8%A8-%D8%B3%D8%A7%DB%8C%D8%AA-%D9%85%D9%88%D8%B2-%D8%B1%D8%A7%DB%8C%DA%AF%D8%A7%D9%86-%D8%A7%D8%B4%D8%AA%D8%B1%D8%A7%DA%A9-%D8%B4%D8%AE%D8%B5%DB%8C-%D8%A8%D8%B1%D8%A7%DB%8C-%DA%A/2067/40

2 Likes

Only you are aren’t using the “og” + but a different persian symbol that looks like it? Can you share a string that repros the problem?

3 Likes

I edited my previous reply. Just to confirm it is a + .

2 Likes

That is weird, for me the slug turns into

%DA%AF%D8%B1%D8%A8%D9%87-%D9%87%D8%A7%DB%8C-%D8%A7%DB%8C%D8%B1%D8%A7%D9%86%DB%8C-%D8%A7%D8%B2-%D9%86%DA%98%D8%A7%D8%AF-%D8%AE%D9%88%D8%A8%DB%8C-%D8%A8%D8%B1%D8%AE%D9%88%D8%B1%D8%AF%D8%A7%D8%B1-%D9%87%D8%B3%D8%AA%D9%86%D8%AF

Are you sure you are running latest and refreshed the page?

2 Likes

I am running the latest version.

I am confused now. I created a new topic with the same condition as the topic with corrupt slug. It works just fine. Just like you stated, probably it isn’t the + that is causing the problem.

Please allow me sometime to install a dummy and make some tests. I will update this topic with more information.

Thank you

2 Likes

Did you get that URL from the share button? It was double encoding and I just fixed that on the latest merge.

2 Likes

Check this screencast.

3 Likes

Oh I see the problem. It only happens with slugs who are above 255 chars and only in 66% of the cases. I will work in a fix tomorrow.

12 Likes

Happens with us too:

eg: Γνωμη για αγορα μπουζουκιου μεσω ιντερνετ και εκτίμηση - Μουσικά Όργανα - Ρεμπέτικο Φόρουμ

Strangely, it only happens when you hit the topic from the “latest” list. When you link to it from another topic, it works just fine.

The full link:
https://rembetiko.gr/t/%CE%B3%CE%BD%CF%89%CE%BC%CE%B7-%CE%B3%CE%B9%CE%B1-%CE%B1%CE%B3%CE%BF%CF%81%CE%B1-%CE%BC%CF%80%CE%BF%CF%85%CE%B6%CE%BF%CF%85%CE%BA%CE%B9%CE%BF%CF%85-%CE%BC%CE%B5%CF%83%CF%89-%CE%B9%CE%BD%CF%84%CE%B5%CF%81%CE%BD%CE%B5%CF%84-%CE%BA%CE%B1%CE%B9-%CE%B5%CE%BA%C/38511/2

Same thing, that slug is over 255 chars.

4 Likes

While investigating, I found some categories that can’t load at all.

I found that we get these kind of errors:

URIError: URI malformed
    at decodeURIComponent (<anonymous>)
    at a (https://rembetiko.gr/assets/ember_jquery-7dfac344d893a6c10c016353b994db2c6f42af630322ea6da3399c220fcc50ed.js:16:31208)
    at Array.map (<anonymous>)
    at o (https://rembetiko.gr/assets/ember_jquery-7dfac344d893a6c10c016353b994db2c6f42af630322ea6da3399c220fcc50ed.js:16:31136)
    at P.recognize (https://rembetiko.gr/assets/ember_jquery-7dfac344d893a6c10c016353b994db2c6f42af630322ea6da3399c220fcc50ed.js:17:5729)
    at t.applyToState (https://rembetiko.gr/assets/ember_jquery-7dfac344d893a6c10c016353b994db2c6f42af630322ea6da3399c220fcc50ed.js:17:22054)
    at u.n.getTransitionByIntent (https://rembetiko.gr/assets/ember_jquery-7dfac344d893a6c10c016353b994db2c6f42af630322ea6da3399c220fcc50ed.js:17:24304)
    at u.n.transitionByIntent (https://rembetiko.gr/assets/ember_jquery-7dfac344d893a6c10c016353b994db2c6f42af630322ea6da3399c220fcc50ed.js:17:23609)
    at u.n.doTransition (https://rembetiko.gr/assets/ember_jquery-7dfac344d893a6c10c016353b994db2c6f42af630322ea6da3399c220fcc50ed.js:17:25611)
    at u.n.transitionTo (https://rembetiko.gr/assets/ember_jquery-7dfac344d893a6c10c016353b994db2c6f42af630322ea6da3399c220fcc50ed.js:17:30132)
TypeError: Cannot read property 'responseJSON' of undefined
    at n.error (https://rembetiko.gr/assets/application-5d69c42124908eb6b41549efae9db9b1df26741f3a45075c6bfd603bb5267a42.js:71:604)
    at n.C (https://rembetiko.gr/assets/ember_jquery-7dfac344d893a6c10c016353b994db2c6f42af630322ea6da3399c220fcc50ed.js:8:17733)
    at u.c.triggerEvent (https://rembetiko.gr/assets/ember_jquery-7dfac344d893a6c10c016353b994db2c6f42af630322ea6da3399c220fcc50ed.js:8:21275)
    at e.t.trigger (https://rembetiko.gr/assets/ember_jquery-7dfac344d893a6c10c016353b994db2c6f42af630322ea6da3399c220fcc50ed.js:17:13392)
    at u.c.transitionDidError (https://rembetiko.gr/assets/ember_jquery-7dfac344d893a6c10c016353b994db2c6f42af630322ea6da3399c220fcc50ed.js:8:21548)
    at https://rembetiko.gr/assets/ember_jquery-7dfac344d893a6c10c016353b994db2c6f42af630322ea6da3399c220fcc50ed.js:17:11836
    at f (https://rembetiko.gr/assets/ember_jquery-7dfac344d893a6c10c016353b994db2c6f42af630322ea6da3399c220fcc50ed.js:18:1126)
    at T (https://rembetiko.gr/assets/ember_jquery-7dfac344d893a6c10c016353b994db2c6f42af630322ea6da3399c220fcc50ed.js:18:2503)
    at E (https://rembetiko.gr/assets/ember_jquery-7dfac344d893a6c10c016353b994db2c6f42af630322ea6da3399c220fcc50ed.js:18:2402)
    at y (https://rembetiko.gr/assets/ember_jquery-7dfac344d893a6c10c016353b994db2c6f42af630322ea6da3399c220fcc50ed.js:18:1896)

Can those be related?

(you can check for yourself here: https://rembetiko.gr/c/άλλα-θέματα/μικρές-αγγελίες)

2 Likes

@Arta_S and @chrispanag two more fixes incoming, one for long titles and the other for subcategories.

https://github.com/discourse/discourse/commit/2304dcf993f626c86b0cab43d33dc7005e850fb9

and

https://github.com/discourse/discourse/commit/f97b6e85daac2c872a710748dfe004aabb3cff72

8 Likes

After upgrading, we still get this error :confused:

2 Likes

In this case you will need to rebake the slugs, please try:

cd /var/discourse
./launcher enter app
rails c
Topic.update_all(slug: nil)
exit
exit
exit
6 Likes

Two days ago from last update I have two problems:

1: 400 Bad Request URL in some topic
2: timeline disappeared in some topic

host Discourse 'standard-plan"

Can you Help Me

sorry i don’t write English well

2 Likes