fix: fix remove_language_code not removing language codes from region-specific url paths

This helper function wasn't capable of removing region-specific language codes from any url 'cause the regex only checked for two-letter language codes (like 'en'), ignoring region-specific locales like 'es-ar'
This commit is contained in:
Francisco
2026-01-08 18:15:17 -05:00
parent c9b1ed0bba
commit 58c897a3bb

View File

@@ -200,5 +200,5 @@ def remove_language_code(path):
Removes optional language code at the start of a path
"""
pattern = r'^/[a-z]{2}(?=/)'
return re.sub(pattern, '', path)
pattern = r'^/[a-z]{2}(-[a-z]{2,4})?/'
return re.sub(pattern, '/', path)