[tomboy] Properly encode/decode note title for XML and JSON.
- From: Sanford Armstrong <sharm src gnome org>
- To: svn-commits-list gnome org
- Subject: [tomboy] Properly encode/decode note title for XML and JSON.
- Date: Sun, 24 May 2009 00:35:51 -0400 (EDT)
commit 11539e590aa22102cd3637f272e4721af8021ec8
Author: Sandy Armstrong <sanfordarmstrong gmail com>
Date: Sat May 23 21:34:57 2009 -0700
Properly encode/decode note title for XML and JSON.
---
Tomboy/Addins/WebSyncService/NoteConvert.cs | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/Tomboy/Addins/WebSyncService/NoteConvert.cs b/Tomboy/Addins/WebSyncService/NoteConvert.cs
index a64983d..76e3a48 100644
--- a/Tomboy/Addins/WebSyncService/NoteConvert.cs
+++ b/Tomboy/Addins/WebSyncService/NoteConvert.cs
@@ -40,7 +40,12 @@ namespace Tomboy.WebSync
NoteInfo noteInfo = new NoteInfo ();
noteInfo.Guid = note.Id;
- noteInfo.Title = note.Title;
+ noteInfo.Title = note.Title
+ .Replace ("&", "&")
+ .Replace ("<", "<")
+ .Replace (">", ">")
+ .Replace ("\"", """)
+ .Replace ("\'", "'");
noteInfo.OpenOnStartup = note.IsOpenOnStartup;
noteInfo.Pinned = note.IsPinned;
noteInfo.CreateDate = note.CreateDate;
@@ -105,10 +110,15 @@ namespace Tomboy.WebSync
// Guid, Title, NoteContent, and NoteContentVersion
// TODO: Is this true? What happens if dates are excluded?
NoteData noteData = new NoteData (NoteUriFromGuid (noteInfo.Guid));
- noteData.Title = noteInfo.Title;
+ noteData.Title = noteInfo.Title
+ .Replace ("&", "&")
+ .Replace ("<", "<")
+ .Replace (">", ">")
+ .Replace (""", "\"")
+ .Replace ("'", "\'");
noteData.Text = string.Format ("<note-content version=\"{0}\">{1}\n\n{2}</note-content>",
noteInfo.NoteContentVersion,
- noteData.Title,
+ noteInfo.Title,
noteInfo.NoteContent);
if (noteInfo.LastChangeDate.HasValue)
noteData.ChangeDate = noteInfo.LastChangeDate.Value;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]