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

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

Open
malcjackson opened this issue Sep 28, 2023 · 6 comments
Assignees
Milestone

Comments

@malcjackson
Copy link

malcjackson commented Sep 28, 2023

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 pbowen-oc added this to the Next milestone Sep 28, 2023
@pbowen-oc
Copy link

@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
Copy link
Member

MartijnR commented Oct 4, 2023

As seen in this screenshot

forgotten to include

@MartijnR
Copy link
Member

MartijnR commented Oct 4, 2023

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
Copy link

@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
Copy link
Member

MartijnR commented Oct 12, 2023

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:

  • see if it still occurs in 6.2.2 on OC dev server
  • inspect the whole /submission/ response more thoroughly and compare the successful and failing /media/get/1/... URLs especially the path part right after /1/, as well as the values in the XML instance.
  • go through client-side code and figure out under what conditions the client would simply append the filename to the webform URL and try to load it that way (and ignore the instance_attachments map, but only for drawings (not other files)).

@pbowen-oc
Copy link

pbowen-oc commented Nov 1, 2023

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.

@MartijnR MartijnR transferred this issue from OpenClinica/enketo-express-oc May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants