summaryrefslogtreecommitdiffstats
path: root/public/javascripts/project_identifier.js
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2013-01-15 19:44:21 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2013-01-15 19:44:21 +0000
commit48c3785991f789f34171dfd687b30664c8915a73 (patch)
treeb29ff9e78934f93d864418a1dcb3bac58480f497 /public/javascripts/project_identifier.js
parent04ab2f24585f0639b4efdba3c75f9b67b17bea87 (diff)
downloadredmine-48c3785991f789f34171dfd687b30664c8915a73.tar.gz
redmine-48c3785991f789f34171dfd687b30664c8915a73.zip
Underscores are allowed in project identifiers (#9225).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11195 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'public/javascripts/project_identifier.js')
-rw-r--r--public/javascripts/project_identifier.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/public/javascripts/project_identifier.js b/public/javascripts/project_identifier.js
index bfbce3cbe..298ca38f2 100644
--- a/public/javascripts/project_identifier.js
+++ b/public/javascripts/project_identifier.js
@@ -51,8 +51,8 @@ function generateProjectIdentifier(identifier, maxlength) {
for(var i=0; i<diacriticsMap.length; i++) {
identifier = identifier.replace(diacriticsMap[i].letters, diacriticsMap[i].base);
}
- identifier = identifier.replace(/[^a-z0-9]+/gi, '-'); // remaining non-alphanumeric => hyphen
- identifier = identifier.replace(/^[-\d]*|-*$/g, ''); // remove hyphens and numbers at beginning and hyphens at end
+ identifier = identifier.replace(/[^a-z0-9_]+/gi, '-'); // remaining non-alphanumeric => hyphen
+ identifier = identifier.replace(/^[-_\d]*|[-_]*$/g, ''); // remove hyphens/underscores and numbers at beginning and hyphens/underscores at end
identifier = identifier.toLowerCase(); // to lower
identifier = identifier.substr(0, maxlength); // max characters
return identifier;