Opened 16 years ago

Last modified 15 years ago

#2482 closed defect

[patch] updating description causes conversion of line endings — at Version 5

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.

Change History (7)

Changed 16 years ago by Steffen Pingel

Attachment: convert-line-endings.patch added

fix

comment:1 Changed 16 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 15 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 15 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 15 years ago by osimons

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

comment:4 Changed 15 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 15 years ago by Steffen Pingel

Description: modified (diff)

Works perfectly! Tested for descriptions and custom fields.

Note: See TracTickets for help on using tickets.