Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Line breaks changed during alternating edits with browser and plug-in #47

Open
kuhmuh opened this issue Sep 15, 2014 · 0 comments
Open

Comments

@kuhmuh
Copy link

kuhmuh commented Sep 15, 2014

Hi,

I tested Redmine plug-in for eclipse and observed the following: When someone edits an issue with a browser and after that with the plug-in, line breaks in 'LONG TEXT' (custom) fields could be broken and falsely marked as changed when editing alternating with browser and plugin. This is quite annoying, because it shows changes in the history (and sent mails etc.), when no changes were made.
I did not really investigate how many platform issues play a role in this but it occurred in our environment with Bitnami Redmine Stack on a Mac server. Clients were Windows and Mac OSX with almost all kind of browsers (Chrome, Safari, FF, IE ). I personally tested with OSX and FF 24 ESR and current eclipse plug-in from GitHub on Ecplise Kepler.
As I observed the data is transferred as follows:
Redmine sends

[DEBUG] content - << "    <customValue id="20147" customFieldId="18">[0xc3][0xb6][0xc3][0xa4][0xc3][0xbc][\r][\n]"
[DEBUG] content - << "[0xc3][0xb6][0xc3][0xa4][0xc3][0xbc][\r][\n]"
[DEBUG] content - << "</customValue>[\n]"

and Plugin sends

"18":"[0xc3][0xb6][0xc3][0xa4][0xc3][0xbc]\n[0xc3][0xb6][0xc3][0xa4][0xc3][0xbc]\n"

Thus the '\r\n' is replaced by a single '\n' w/o edit.

As fix for us internally I changed the IssueRequestEntity#writeValue() method as follows:

private static void writeValue(JSONWriter jsonWriter, String key, String value) throws JSONException {
        jsonWriter.key(key).value(value==null ? "" : value.replaceAll("\\n", "\r\n")); //$NON-NLS-1$
    }

This solves the issue for us. I don't know if this is a considerable solution for you, but maybe it helps.

Best regards
Stefan

kuhmuh pushed a commit to kuhmuh/redmine-mylyn-plugin that referenced this issue Sep 17, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant