You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2016/01/11 19:15:15 UTC
[2/2] allura git commit: [#8041] JS doesn't support lookbehind
assertions. And regexes don't need to be marked safe
[#8041] JS doesn't support lookbehind assertions. And regexes don't need to be marked safe
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/71c5e82b
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/71c5e82b
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/71c5e82b
Branch: refs/heads/master
Commit: 71c5e82b21f1dc1285f2a50471351d24362b17ff
Parents: bb4c5c0
Author: Dave Brondsema <da...@brondsema.net>
Authored: Mon Jan 11 13:14:34 2016 -0500
Committer: Dave Brondsema <da...@brondsema.net>
Committed: Mon Jan 11 13:14:34 2016 -0500
----------------------------------------------------------------------
Allura/allura/ext/admin/templates/project_install_tool.html | 6 +++---
Allura/allura/lib/helpers.py | 7 ++++---
2 files changed, 7 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/71c5e82b/Allura/allura/ext/admin/templates/project_install_tool.html
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/admin/templates/project_install_tool.html b/Allura/allura/ext/admin/templates/project_install_tool.html
index 900b031..fccd193 100644
--- a/Allura/allura/ext/admin/templates/project_install_tool.html
+++ b/Allura/allura/ext/admin/templates/project_install_tool.html
@@ -22,12 +22,12 @@
<h1> Installing {{ tool.tool_label }} </h1>
{% if tool_name == 'subproject' %}
- {% set mount_point_re = h.re_mount_points['re_project_name']|safe %}
+ {% set mount_point_re = h.re_mount_points['re_project_name'] %}
{% set max_length = 15 %}
{% else %}
- {% set mount_point_re = h.re_mount_points['re_relaxed_tool_mount_point']|safe
+ {% set mount_point_re = h.re_mount_points['re_relaxed_tool_mount_point']
if g.entry_points['tool'][tool_name].relaxed_mount_points
- else h.re_mount_points['re_tool_mount_point']|safe %}
+ else h.re_mount_points['re_tool_mount_point'] %}
{% set max_length = 62 %}
{% endif %}
http://git-wip-us.apache.org/repos/asf/allura/blob/71c5e82b/Allura/allura/lib/helpers.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/helpers.py b/Allura/allura/lib/helpers.py
index c66b3f5..544b027 100644
--- a/Allura/allura/lib/helpers.py
+++ b/Allura/allura/lib/helpers.py
@@ -70,12 +70,13 @@ log = logging.getLogger(__name__)
# http://stackoverflow.com/questions/2063213/regular-expression-for-validating-dns-label-host-name
# modified to remove capital A-Z and make length parameterized
-dns_var_length = r'^(?![0-9]+$)(?!-)[a-z0-9-]{%s}(?<!-)$'
+# and not use lookbehind assertion since JS doesn't support that
+dns_var_length = r'^(?![0-9]+$)(?!-)[a-z0-9-]{%s}[a-z0-9]$'
# project & tool names must comply to DNS since used in subdomains for emailing
re_mount_points = {
- 're_project_name': dns_var_length % '3,15', # validates project, subproject, and user names
- 're_tool_mount_point': dns_var_length % '1,63', # validates tool mount point names
+ 're_project_name': dns_var_length % '2,14', # validates project, subproject, and user names
+ 're_tool_mount_point': dns_var_length % '0,62', # validates tool mount point names
're_tool_mount_point_fragment': r'[a-z][-a-z0-9]*',
're_relaxed_tool_mount_point': r'^[a-zA-Z0-9][-a-zA-Z0-9_\.\+]{0,62}$',
're_relaxed_tool_mount_point_fragment': r'[a-zA-Z0-9][-a-zA-Z0-9_\.\+]*'