Modify

Opened 6 years ago

Closed 5 years ago

#2482 closed defect (fixed)

[patch] updating description causes conversion of line endings

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

Description (last modified by stp)

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 stp 6 years ago.
fix
t2482-line_endings-r6050.diff (891 bytes) - added by osimons 5 years ago.
Standardize all string input to \r\n line-endings.

Download all attachments as: .zip

Change History (8)

Changed 6 years ago by stp

fix

comment:1 Changed 6 years ago by stp

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 5 years ago by stp

  • Cc osimons added

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

comment:3 Changed 5 years ago by stp

  • Owner changed from athomas to osimons
  • Priority changed from normal to highest
  • Summary changed from updating description causes conversion of line endings to [patch] updating description causes conversion of line endings

Changed 5 years ago by osimons

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

comment:4 Changed 5 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 5 years ago by stp

  • Description modified (diff)

Works perfectly! Tested for descriptions and custom fields.

comment:6 Changed 5 years ago by osimons

  • Resolution set to fixed
  • Status changed from new to closed

(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.

Add Comment

Modify Ticket

Action
as closed .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from osimons. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.