From f035815f7ac9fc54c76aaff32a402e9c424ab21e Mon Sep 17 00:00:00 2001
From: zzz <zzz@mail.i2p>
Date: Mon, 7 Oct 2013 14:45:11 +0000
Subject: [PATCH]    - Don't truncate initial news header if it appears in
 summary bar      (unlikely as we don't show the "hide news" button for
 initial news)      Also prevent string IOOBE

---
 .../java/src/net/i2p/router/web/SummaryBarRenderer.java   | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/apps/routerconsole/java/src/net/i2p/router/web/SummaryBarRenderer.java b/apps/routerconsole/java/src/net/i2p/router/web/SummaryBarRenderer.java
index 496c41cab0..ee2274985a 100644
--- a/apps/routerconsole/java/src/net/i2p/router/web/SummaryBarRenderer.java
+++ b/apps/routerconsole/java/src/net/i2p/router/web/SummaryBarRenderer.java
@@ -622,7 +622,13 @@ public class SummaryBarRenderer {
                     // Add offset to start:
                     // 4 - gets rid of <h3>
                     // 16 - gets rid of the date as well (assuming form "<h3>yyyy-mm-dd: Foobarbaz...")
-                    newsContent = newsContent.substring(start+16, newsContent.length());
+                    // Don't truncate the "congratulations" in initial news
+                    if (newsContent.length() > start + 16 &&
+                        newsContent.substring(start + 4, start + 6).equals("20") &&
+                        newsContent.substring(start + 14, start + 16).equals(": "))
+                        newsContent = newsContent.substring(start+16, newsContent.length());
+                    else
+                        newsContent = newsContent.substring(start+4, newsContent.length());
                     int end = newsContent.indexOf("</h3>");
                     if (end >= 0) {
                         String heading = newsContent.substring(0, end);
-- 
GitLab