[tomboy] [WebSync] Fix parsing problem that caused Tomboy to send blank note content



commit c71746c5f60fed59f3557588a2c9b00041fe3d4a
Author: Sandy Armstrong <sanfordarmstrong gmail com>
Date:   Sat Sep 5 14:03:05 2009 -0700

    [WebSync] Fix parsing problem that caused Tomboy to send blank note content
    
    Include new unit test for <note-content version=""

 Tomboy/Addins/WebSyncService/NoteConvert.cs        |    2 +-
 .../WebSyncService/Tests/NoteConvertTests.cs       |   12 +++++++++---
 2 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/Tomboy/Addins/WebSyncService/NoteConvert.cs b/Tomboy/Addins/WebSyncService/NoteConvert.cs
index 4b8bf33..9af47bc 100644
--- a/Tomboy/Addins/WebSyncService/NoteConvert.cs
+++ b/Tomboy/Addins/WebSyncService/NoteConvert.cs
@@ -57,7 +57,7 @@ namespace Tomboy.WebSync
 				noteInfo.Tags.Add (tag.Name);
 
 			const string noteContentRegex =
-				@"^<note-content(\s+version=""(?<contentVersion>[^""]+)"")?\s*((/>)|(>(?<innerContent>.*)</note-content>))$";
+				@"^<note-content(\s+version=""(?<contentVersion>[^""]*)"")?\s*((/>)|(>(?<innerContent>.*)</note-content>))$";
 			Match m = Regex.Match (note.XmlContent, noteContentRegex, RegexOptions.Singleline);
 			Group versionGroup = m.Groups ["contentVersion"];
 			Group contentGroup = m.Groups ["innerContent"];
diff --git a/Tomboy/Addins/WebSyncService/Tests/NoteConvertTests.cs b/Tomboy/Addins/WebSyncService/Tests/NoteConvertTests.cs
index 5c16c01..f409cc3 100644
--- a/Tomboy/Addins/WebSyncService/Tests/NoteConvertTests.cs
+++ b/Tomboy/Addins/WebSyncService/Tests/NoteConvertTests.cs
@@ -78,9 +78,9 @@ namespace Tomboy.WebSync.Tests
 		public void ToNoteInfoTest ()
 		{
 			// Note content stress tests
-			string [] titles = new string [14];
-			string [] contents = new string [14];
-			string [] expectedInfoContents = new string [14];
+			string [] titles = new string [15];
+			string [] contents = new string [15];
+			string [] expectedInfoContents = new string [15];
 			
 			titles [0] = "(Untitled 238)";
 			contents [0] = @"<note-content version=""0.1"">
@@ -205,6 +205,12 @@ Describe your new note here.</note-content>";
 Describe your new note here.</note-content>";
 			expectedInfoContents [13] = @"
 Describe your new note here.";
+
+			titles [14] = "New Note 331";
+			contents [14] = @"<note-content version="""">New Note 331
+
+Describe your new note here.</note-content>";
+			expectedInfoContents [14] = @"Describe your new note here.";
 			
 
 			for (int i =0; i < titles.Length; i++) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]