*

Wiz

  • ****
  • 138 posts
Hello,

I've got a bug to report -

Bug: When force disable URL encoding is set to true, categories created or updated after enabling the option return a 404 error
Expected: categories created or updated after enabling the option to load fine.
Things noticed: category slugs are saved in their original language form and no longer encoded - perhaps somewhere in core there's a bug with osclass processing unencoded slugs.
Osclass: 8.1.1
Php 8.2.3

Thanks
Wiz
« Last Edit: March 13, 2023, 01:09:00 PM by Wiz »

*

MB Themes

Nothing should be encoded in this case and characters go into url without encoding.
Do not recommend this setting as it might cause a lot of troubles - but some people specifically asked for that :)
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Wiz

  • ****
  • 138 posts
Actual language characters, natural form, are loaded in the url regardless of whether the option is set to true or false.

The issue is with the mechanism of processing/loading natural form by core. I remember seeing something to do with encoding/decoding category slugs when I was trying to troubleshoot the language in URL bug (beta feature). Perhaps that function has a bug somewhere. I presume this new feature was developed to support natural lang form in links used in email templates so people don't see ugly (encoded) urls.

Personally, I view the encoded urls issue as being less important than the language url beta feature which enables proper static lang urls for multi-language platforms, including proper canonicalization, and that is the standard for SEO/search engines. Nevertheless, both are a step forward in the right direction. Add a recommended url structure ie. no commas, uppercase letters, underscores  etc. (as advised by the head of search at Google as well as many SEO experts) and we've got a fully viable solution. Any other approach is considered a patch / workaround and a deviation from best practices.

*

MB Themes

Encoding means characters in url seems like in natural form, but if you copy paste it, its encoded.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Wiz

  • ****
  • 138 posts
Encoding means characters in url seems like in natural form, but if you copy paste it, its encoded.

I lost you there but decode is converting from encoded to original / natural form, for example: مركبات is decoded or natural form and when encoded it is %D9%85%D8%B1%D9%83%D8%A8%D8%A7%D8%AA


*

MB Themes

When you force disable encoding, there is no encode/decode.
Otherwise url is just encoded (but not decoded, that is done by browser)
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots

*

Wiz

  • ****
  • 138 posts
Correct.

Here's the fix (tested and confirmed with Arabic):

Change lines 809 and 872 in osclass/model/Category.php 

From:

Code: [Select]
$fieldsDescription['s_slug'] = $slug;

To:

Code: [Select]
$fieldsDescription['s_slug'] = strtolower(urlencode($slug));


This retains the functionality of the new feature you added without breaking categories (inserting/updating/accessing) on multi-language sites.

Cheers
« Last Edit: March 14, 2023, 08:51:47 AM by Wiz »

*

MB Themes

But you encode data so it's in conflict with that config param.
  To get fast support, we need following details: Detail description, URL to reproduce problem, Screenshots