From 5338dc55402d9bc94f45c0d22c4cb06d55417848 Mon Sep 17 00:00:00 2001
From: zzz <zzz@mail.i2p>
Date: Thu, 21 Jan 2010 14:19:38 +0000
Subject: [PATCH]     * Properties: Don't play games with \r and \n on
 load/save,       it was causing fatal issues on DOS if your username started 
      with r or n

---
 core/java/src/net/i2p/data/DataHelper.java | 9 +++++++--
 router/java/src/net/i2p/router/Router.java | 5 +++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/core/java/src/net/i2p/data/DataHelper.java b/core/java/src/net/i2p/data/DataHelper.java
index 9822415812..6c7ed7dd11 100644
--- a/core/java/src/net/i2p/data/DataHelper.java
+++ b/core/java/src/net/i2p/data/DataHelper.java
@@ -280,8 +280,13 @@ public class DataHelper {
                 String val = line.substring(split+1);   //.trim() ??????????????
                 // Unescape line breaks after loading.
                 // Remember: "\" needs escaping both for regex and string.
-                val = val.replaceAll("\\\\r","\r");
-                val = val.replaceAll("\\\\n","\n");
+
+                // For some reason this was turning \r (one backslash) into CR,
+                // I think it needed one more \\ in the pattern?,
+                // which sucks if your username is randy on DOS,
+                // it was a horrible idea anyway
+                //val = val.replaceAll("\\\\r","\r");
+                //val = val.replaceAll("\\\\n","\n");
                 if ( (key.length() > 0) && (val.length() > 0) )
                     if (forceLowerCase)
                         props.setProperty(key.toLowerCase(), val);
diff --git a/router/java/src/net/i2p/router/Router.java b/router/java/src/net/i2p/router/Router.java
index 6c97b2124d..77a73f65a7 100644
--- a/router/java/src/net/i2p/router/Router.java
+++ b/router/java/src/net/i2p/router/Router.java
@@ -1053,8 +1053,9 @@ public class Router {
                     String val = _config.getProperty(key);
                     // Escape line breaks before saving.
                     // Remember: "\" needs escaping both for regex and string.
-                    val = val.replaceAll("\\r","\\\\r");
-                    val = val.replaceAll("\\n","\\\\n");
+                    // NOOO - see comments in DataHelper
+                    //val = val.replaceAll("\\r","\\\\r");
+                    //val = val.replaceAll("\\n","\\\\n");
                     buf.append(key).append('=').append(val).append('\n');
                 }
             }
-- 
GitLab