Commits

Diego Búrigo Zacarão committed 9029d06

Restricting a bit more the regex for URLS that contain filenames

- At some point we might want to drop it from the URL using GET,
just like '/view/?filename=po/pt_BR.po'. It's probably a better
approach.

Comments (0)

Files changed (1)

transifex/projects/urls.py

         view = component_set_stats,
         name = 'component_set_stats',),
     url(
-        regex = '^p/(?P<project_slug>[-\w]+)/c/(?P<component_slug>[-\w]+)/raw/(?P<filename>(.*))$',
+        regex = '^p/(?P<project_slug>[-\w]+)/c/(?P<component_slug>[-\w]+)/raw/(?P<filename>[_\./-@\w]+)$',
         view = component_file,
         name = 'component_raw_file',),
     url(
-        regex = '^p/(?P<project_slug>[-\w]+)/c/(?P<component_slug>[-\w]+)/view/(?P<filename>(.*))$',
+        regex = '^p/(?P<project_slug>[-\w]+)/c/(?P<component_slug>[-\w]+)/view/(?P<filename>[_\./-@\w]+)$',
         view = component_file,
         name = 'component_view_file',
         kwargs = {'view': True },),
     url(
-        regex = '^p/(?P<project_slug>[-\w]+)/c/(?P<component_slug>[-\w]+)/submit/(?P<filename>(.*))$',
+        regex = '^p/(?P<project_slug>[-\w]+)/c/(?P<component_slug>[-\w]+)/submit/(?P<filename>[_\./-@\w]+)$',
         view = component_submit_file,
         name = 'component_submit_file',),
     url(
     urlpatterns += patterns('',
         url(
             regex = ('^p/(?P<project_slug>[-\w]+)/c/(?P<component_slug>[-\w]+)/'
-                    'edit/(?P<filename>(.*))$'),
+                    'edit/(?P<filename>[_\./-@\w]+)$'),
             # It needs to pass through both 'login_required'
             view = login_required(TransFormWizard(key=None, form_list=[])),
             name = 'component_edit_file',),