OpenClinica / enketo-oc

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

Drawing items not retaining the image when the form is closed and reopened #32

Open malcjackson opened 9 months ago

malcjackson commented 9 months ago

Describe the bug Drawing widget items with an appearance of "signature", "draw", or "annotate" do not continue to show the drawn signature after the form is closed and reopened.

To Reproduce Open a form defined to have an item of type image and appearance signature Fill in a drawn signature image Close the form Reopen the form Signature drawing item is empty

pbowen-oc commented 9 months ago

@MartijnR - We are seeing failed calls to retrieve signature, draw, and annotate item files. As seen in this screenshot, other files are loading when the form is opened but there is no successful call visible for them. So, it seems like the drawing items are trying to load their existing files in an unexpected manner.

MartijnR commented 9 months ago

As seen in this screenshot

forgotten to include

MartijnR commented 9 months ago

Please check if signature file is submitted successfully (and available) in the OC interface. And if so, if it fails to load even if it was submitted successfully.

pbowen-oc commented 9 months ago

@MartijnR - The failed request is like: https://form.us.openclinica-dev.io/edit/fs/c/i/SS_PAB1-1695758102017-drawing-15_55_3.png

But the instance attachment is being sent like: "SS_PAB1-1695758102017-drawing-15_55_3.png": "/media/get/1/80a8eaac219e8fa55e4fba255b6b3f2122dd1bd85a83e50d3a5b0bec435c167b24b1d78cd773a9d0/SS_PAB1-1695758102017-drawing-15_55_3.png",

MartijnR commented 8 months ago

I cannot reproduce this with

curl \
--user changed: \
-d "\
server_url=https://enketo-aggregate.appspot.com&\
form_id=vitals&\
instance=
<demo-vitals-grid-v9>
    <page2>
        <media_yn>1</media_yn>
        <pic_sig>img1.png</pic_sig>
        <pic>img2.png</pic>
        <pic_comment>{\"queries\":[], \"logs\":[{\"type\":\"audit\", \"comment\":\"Value changed
            from \\\"img1.png\\\" to \\\"img2.png\\\"\", \"date_time\":\"2019-03-02 04:00:00
            +06:00\"}]}</pic_comment>
    </page2>
</demo-vitals-grid-v9>&\
instance_id=b&\
instance_attachments[img1.png]=https://github.com/enketo/enketo-express/raw/master/public/images/icon_180x180.png&\
instance_attachments[img2.png]=https://github.com/enketo/enketo-express/raw/master/public/images/offline-enabled.png&\
ecid=a\
" \
http://localhost:8005/oc/api/v1/instance/note

The signature loads correctly in 6.2.2.

The media serving code does not appear to have been changed since Sep 16th, 2022 (4.1.2).

The /submission response for the record is:

{
    "instance": "\n<demo-vitals-grid-v9>\n    <page2>\n        <media_yn>1</media_yn>\n        <pic_sig>img1.png</pic_sig>\n        <pic>img2.png</pic>\n        <pic_comment>{\"queries\":[], \"logs\":[{\"type\":\"audit\", \"comment\":\"Value changed\n            from \\\"img1.png\\\" to \\\"img2.png\\\"\", \"date_time\":\"2019-03-02 04:00:00\n             06:00\"}]}</pic_comment>\n    </page2>\n</demo-vitals-grid-v9>",
    "instanceAttachments": {
        "img1.png": "/media/get/1/b/img1.png",
        "img2.png": "/media/get/1/b/img2.png"
    }
}

However, the failed request URL shown in the previous comment indicates something goes wrong on the client.

next steps:

pbowen-oc commented 8 months ago

The images are being loaded in the latest deployment. We need to test further to confirm it is working as expected. We'll remove the label and add a comment if it looks like further work is needed.