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 2020/10/26 20:13:27 UTC

[allura] 02/02: Strip leading or trailing dashes when suggesting project shortnames

This is an automated email from the ASF dual-hosted git repository.

brondsem pushed a commit to branch db/shortname_legacy
in repository https://gitbox.apache.org/repos/asf/allura.git

commit 80d618a4ef2863beccbf402f8c92d219f2533c83
Author: Dave Brondsema <da...@brondsema.net>
AuthorDate: Mon Oct 26 16:09:09 2020 -0400

    Strip leading or trailing dashes when suggesting project shortnames
---
 Allura/allura/lib/widgets/forms.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Allura/allura/lib/widgets/forms.py b/Allura/allura/lib/widgets/forms.py
index 2374e19..360859a 100644
--- a/Allura/allura/lib/widgets/forms.py
+++ b/Allura/allura/lib/widgets/forms.py
@@ -1066,7 +1066,7 @@ class NeighborhoodAddProjectForm(ForgeForm):
                     }
                 });
                 var suggest_name = function(project_name) {
-                    return project_name.replace(/[^A-Za-z0-9]+/g, '-').toLowerCase();
+                    return project_name.replace(/[^A-Za-z0-9]+/g, '-').toLowerCase().replace(/^-+|-+$/g, '');
                 };
                 var check_names = function() {
                     var data = {