OpenClinica / enketo-oc

OpenClinica's fork of the Enketo web forms monorepo
Apache License 2.0
0 stars 1 forks source link

HTML code for double quotes appear in field history when text field is updated #21

Open eprager412 opened 6 months ago

eprager412 commented 6 months ago

Describe the bug HTML code for double quotes appear in field history when text field is updated

To Reproduce

  1. Open attached form in mode /single/fs/ history_html_simple.txt

  2. In the Additional Comments field, type "ddd", tab off the field and open query widget 3: History displays Value changed from quotequote to quotedddquote Expected behavior History displays Value changed from "" to "ddd"

Screenshots history_html history_html2

Browser and OS Windows/Chrome

MartijnR commented 6 months ago

Ignore the below. I was for some reason thinking this happened when editing an existing record.


curl --user enketorules: -d \
"server_url=http://localhost:3000&form_id=language.test&ecid=a&lang=de&instance=\
<data xmlns:OpenClinica= \"http://openclinica.com/odm\" xmlns:enk= \"http://enketo.org/xforms\" xmlns:jr= \"http://openrosa.org/javarosa\" xmlns:oc= \"http://openclinica.org/xforms\" xmlns:orx= \"http://openrosa.org/xforms\" id= \"language.test\" version= \"1\">\
    <page1>\
        <locale_note />\
        <yn1 />\
        <locale_note_comment oc:queryParent= \"locale_note\" />\
        <yn1_comment oc:queryParent= \"yn1\">\
    {\"queries\":[{\"type\":\"comment\",\"id\":\"1\",\"date_time\":\"2023-01-18T11:34:36.608-05:00\",\"comment\":\"\\\"img1.png\\\" to \\\"img2.png\\\"\",\"status\":\"new\",\"assigned_to\":\"\",\"notify\":false,\"thread_id\":\"50b52cae-6c5b-4d1a-ab70-3e05b31e3784\"}]}</yn1_comment>\
    </page1>\
<meta>\
        <instanceID>uuid:e1623dbf-bf87-4b2a-8a5a-85ae832f31f3</instanceID>\
    </meta></data>\
&instance_id=123" http://localhost:8005/oc/api/v1/instance/edit
pbowen-oc commented 6 months ago

@theywa - Can you work on this?

theywa commented 6 months ago

@pbowen-oc Sure, I just created a PR for the fix.

Hi @MartijnR, I just created a PR to fix the issue. Can you review it in your spare time? Thanks I found this issue happens only on new audit query where the string encoded after proceced by the translator code

comment = t('widget.dn.valuechange', { new: "${this._getLabelForSelectValue(currentValue)}", previous: "${this._getLabelForSelectValue(previousValue)}", });

so I put the decode function to reset it back.