NotificationEmail: Fix eliding project name without slash

When a project name does not contain a slash, the name should not
be elided with "...".

Add extra tests that would have caught this.

Bug: Issue 10896
Change-Id: I131fa5c5016e758e8c6d7d2b09625fae6593da7b
This commit is contained in:
David Pursehouse
2019-05-22 09:44:36 +09:00
parent e003f87869
commit 8eece83e9a
2 changed files with 8 additions and 0 deletions

View File

@@ -132,6 +132,9 @@ public abstract class NotificationEmail extends OutgoingEmail {
if (lastIndexSlash == 0) {
return projectName.substring(1); // Remove the first slash
}
if (lastIndexSlash == -1) { // No slash in the project name
return projectName;
}
return "..." + projectName.substring(lastIndexSlash + 1);
}