提交 06131ad0 编写于 作者: K kohsuke

relaxing the rule further.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@9725 71c3de6d-444a-0410-be80-ed276b4c234a
上级 62a358f6
......@@ -837,5 +837,26 @@ public class Functions {
return Stapler.getCurrentRequest().getContextPath()+'/'+itUrl+urlName;
}
/**
* Escapes the character unsafe for e-mail address.
* See http://en.wikipedia.org/wiki/E-mail_address for the details,
* but here the vocabulary is even more restricted.
*/
public static String toEmailSafeString(String projectName) {
// TODO: escape non-ASCII characters
StringBuilder buf = new StringBuilder(projectName.length());
for( int i=0; i<projectName.length(); i++ ) {
char ch = projectName.charAt(i);
if(('a'<=ch && ch<='z')
|| ('z'<=ch && ch<='Z')
|| ('0'<=ch && ch<='9')
|| "-_.".indexOf(ch)>=0)
buf.append(ch);
else
buf.append('_'); // escape
}
return projectName;
}
private static final Pattern SCHEME = Pattern.compile("[a-z]+://.+");
}
......@@ -1057,7 +1057,7 @@ public final class Hudson extends View implements ItemGroup<TopLevelItem>, Node,
*/
public TopLevelItem getJobCaseInsensitive(String name) {
for (Entry<String, TopLevelItem> e : items.entrySet()) {
if(e.getKey().equalsIgnoreCase(name))
if(Functions.toEmailSafeString(e.getKey()).equalsIgnoreCase(Functions.toEmailSafeString(name)))
return e.getValue();
}
return null;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册