Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

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

Francisco58c897a3bb97
diff --git a/wger/utils/helpers.py b/wger/utils/helpers.py
index 828889f3e..a44caa03e 100644
--- a/wger/utils/helpers.py
+++ b/wger/utils/helpers.py
@@ -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)