mirror of
https://github.com/wger-project/wger.git
synced 2026-02-18 00:17:51 +01:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user