\r
#### fixes\r
\r
+- Author metrics can be broken by newlines in email addresses from converted repositories (issue 176)\r
- Set subjectAlternativeName on generated SSL cert if CN is an ip address (issue 170)\r
- Fixed incorrect links on history page for files not in the current/active commit (issue 166)\r
- Empty repository page failed to handle missing repository (issue 160)\r
import org.eclipse.jgit.lib.PersonIdent;\r
import org.eclipse.jgit.revwalk.RevCommit;\r
\r
+import com.gitblit.utils.StringUtils;\r
import com.gitblit.utils.TimeUtils;\r
\r
/**\r
}\r
repositoryMetrics.get(repository).count++;\r
\r
- String author = commit.getAuthorIdent().getEmailAddress()\r
- .toLowerCase();\r
+ String author = StringUtils.removeNewlines(commit.getAuthorIdent().getEmailAddress()).toLowerCase(); \r
if (!authorMetrics.containsKey(author)) {\r
authorMetrics.put(author, new Metric(author));\r
}\r
p = rev.getAuthorIdent().getEmailAddress().toLowerCase();\r
}\r
}\r
+ p = p.replace('\n',' ').replace('\r', ' ').trim();\r
if (!metricMap.containsKey(p)) {\r
metricMap.put(p, new Metric(p));\r
}\r
Matcher m = p.matcher(input);\r
return m.matches();\r
}\r
+ \r
+ /**\r
+ * Removes new line and carriage return chars from a string.\r
+ * If input value is null an empty string is returned.\r
+ * \r
+ * @param input\r
+ * @return a sanitized or empty string\r
+ */\r
+ public static String removeNewlines(String input) {\r
+ if (input == null) {\r
+ return "";\r
+ }\r
+ return input.replace('\n',' ').replace('\r', ' ').trim();\r
+ }\r
}
\ No newline at end of file
Constants.SearchType searchType) {\r
String name = identity == null ? "" : identity.getName();\r
String address = identity == null ? "" : identity.getEmailAddress();\r
+ name = StringUtils.removeNewlines(name);\r
+ address = StringUtils.removeNewlines(address);\r
boolean showEmail = GitBlit.getBoolean(Keys.web.showEmailAddresses, false);\r
if (!showEmail || StringUtils.isEmpty(name) || StringUtils.isEmpty(address)) {\r
String value = name;\r