Opened 17 years ago
Closed 15 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 )
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)
Change History (8)
Changed 17 years ago by
Attachment: | convert-line-endings.patch added |
---|
comment:1 Changed 17 years ago by
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
Cc: | osimons added; anonymous removed |
---|
Can you consider this patch? It's problem that frequently causes confusion.
comment:3 Changed 15 years ago by
Owner: | changed from Alec Thomas to osimons |
---|---|
Priority: | normal → highest |
Summary: | updating description causes conversion of line endings → [patch] updating description causes conversion of line endings |
Changed 15 years ago by
Attachment: | t2482-line_endings-r6050.diff added |
---|
Standardize all string input to \r\n
line-endings.
comment:4 Changed 15 years ago by
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
Description: | modified (diff) |
---|
Works perfectly! Tested for descriptions and custom fields.
comment:6 Changed 15 years ago by
Resolution: | → fixed |
---|---|
Status: | new → 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.
fix