Creating new notes in Notes.app botches note body when body is provided as HTML

Originator:dloewenherz
Number:rdar://26180797 Date Originated:09-May-2016 04:38 PM
Status:Open Resolved:
Product:OS X Product Version:Notes.app 4.2 (555.10.42)
Classification:Bug Reproducible:Always
 
Summary:
When creating a new HTML note in Notes.app with AppleScript, Notes.app re-formats the inserted note text inappropriately. This bug only presents itself when creating new notes in an iCloud folder. Creating notes in a non-iCloud folder appears to present no issues.

Steps to Reproduce:
1. Open Notes.app.
2. Create a folder called “Radar Test”.
3. Run the following in a terminal to bring up the interactive AppleScript interpreter:

$ osascript -il JavaScript

4. Paste the following code into the interpreter.

    var app = Application('Notes');
    app.includeStandardAdditions = true;
    app.activate();

    var folder = app.folders.byName("Radar Test");
    folder.notes.push(app.Note({
        'name': "My New Note",
        'body': "<ul><li>One</li><li>Two</li></ul>"
    }));

5. Read HTML content of note by pasting the following into the interpreter:

    app.notes.byName("My New Note").body()



Expected Results:
The note body should be “<div>My New Note</div>\n<div><br></div>\n<ul>\n<li>One</li>\n<li>Two</li>\n</ul>\n”, the same output which occurs if you manually edit the created note to contain a bulleted list with the same items (“One” and “Two”).

Actual Results:
The note body is "<div>My New Note</div>\n<div><br></div>\n<div>\t•\tOne</div>\n<div>\t•\tTwo</div>\n”.

Also observe that the original line breaks have been removed.

Version:
Notes.app 4.2 (555.10.42)

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!