Modify

Opened 17 years ago

Closed 16 years ago

#2482 closed defect (fixed)

[patch] updating description causes conversion of line endings

Reported by: Steffen Pingel Owned by: osimons
Priority: highest Component: XmlRpcPlugin
Severity: major Keywords:
Cc: osimons Trac Release: 0.10

Description (last modified by Steffen Pingel)

When a Trac ticket with an editable description that was previously edited in the web-interface is updated through Mylyn the description changes. This can be seen on ticket #2462 comment 3 for instance.

Line endings submitted through the web are encoded as \r\n. It appears that this is also the format that is stored in the Trac database. When strings are received through XML all line endings are normalized to \n. That means when a description is received by the XmlRpcPlugin all line breaks are encoded as \n. The next time the ticket is updated through the web they are converted back to \r\n.

The corresponding Mylyn bug is here:

213742: submit causes description to change https://bugs.eclipse.org/bugs/show_bug.cgi?id=213742

I'll attach a patch that converts the line endings to \r\n before updating the ticket in the database.

Attachments (2)

convert-line-endings.patch (2.3 KB) - added by Steffen Pingel 17 years ago.
fix
t2482-line_endings-r6050.diff (891 bytes) - added by osimons 16 years ago.
Standardize all string input to \r\n line-endings.

Download all attachments as: .zip

Change History (8)

Changed 17 years ago by Steffen Pingel

Attachment: convert-line-endings.patch added

fix

comment:1 Changed 17 years ago by Steffen Pingel

This a first pass at fixing it for the ticket API. The same changes probably need to be applied to the wiki API as well. I have briefly tested the patch but haven't yet run the whole Mylyn test suite.

comment:2 Changed 16 years ago by Steffen Pingel

Cc: osimons added; anonymous removed

Can you consider this patch? It's problem that frequently causes confusion.

comment:3 Changed 16 years ago by Steffen Pingel

Owner: changed from Alec Thomas to osimons
Priority: normalhighest
Summary: updating description causes conversion of line endings[patch] updating description causes conversion of line endings

Changed 16 years ago by osimons

Standardize all string input to \r\n line-endings.

comment:4 Changed 16 years ago by osimons

Description: modified (diff)

t2482-line_endings-r6050.diff standardizes line-endings on input to the as same received by web input. xmlrpclib.loads() will convert any \r\n received by clients to \n, and same with dump() that also standardizes on \n for all output.

Converting only on input seems to catch all relevant use-cases for any argument and method, and it seems to work OK in my limited testing. Further testing and feedback welcome :-)

comment:5 Changed 16 years ago by Steffen Pingel

Description: modified (diff)

Works perfectly! Tested for descriptions and custom fields.

comment:6 Changed 16 years ago by osimons

Resolution: fixed
Status: newclosed

(In [6053]) XmlRpcPlugin: Standardize all string inputs with line-ending \r\n to match what is received through a web client. This avoids phantom-changes to multi-line inputs on subsequent update via web.

Closes #2482.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain osimons.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.