-
Notifications
You must be signed in to change notification settings - Fork 165
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
Return MD5 hash for form attachments #758
Comments
Hie @matthew-white is this a good first issue to be picked up? |
Hi @karntrehan, If this is something you are interested in and able to work on soon, that would be great. @matthew-white is working in central-frontend on redesigning the form draft experience, and this is related to that change. He is not blocked on this backend change at the moment, but was hoping it could be ready in the next week or so (by ~Nov 6). I was planning to work on it, but I have many other things to do, so you are welcome to try it! If so, I will be the one reviewing. If you don't get to it, no worries, I can take it back. I will leave it for you until Nov 6 or until I hear from you. See current form attachment API docs here. We chatted today and some decisions are:
I would look at this code for fetching the md5 from the blobs table for OpenRosa form attachments: And this |
just some considerations:
|
For #728, Frontend won't need to use the browser Crypto API. Frontend won't be downloading the content of form attachments, but we want to make it easy for Frontend to indicate to the user when a form attachment has changed. Backend calculates and stores
We actually don't use Postgres at all for this, even for |
Hie @matthew-white, thank you for the details. I will take some time to setup central locally and hence would miss the 6th (today) deadline. I would still go ahead with the installation and start looking into the issue to understand more about the working of central. Thanks. |
Sounds good. Note that many issues only require setting up the |
For #728, Frontend needs to be able to compare the form attachments of the published version of the form with the form attachments of the draft version. We've discussed that Frontend could do so by comparing the MD5 hashes of the attachments. Collect similarly uses the MD5 hash returned via OpenRosa to determine whether a form attachment has changed.
We store the MD5 hash for each blob, but we don't return it over the API. This issue is to return the MD5 hash for form attachments. Maybe it'd be nice for symmetry to also return it for submission attachments, but that's not necessary for this issue. Frontend will just be comparing form attachments, not submission attachments.
We already return the MD5 hash for forms and form versions over the API. For #728, Frontend will be using that hash to determine whether the XForm itself has changed. The name of the MD5 hash in the form response is
hash
. We also returnsha
andsha256
in that response. In the database, the column name for the MD5 hash ishash
in theform_defs
table andmd5
in theblobs
table. In terms of what to return over the API for this issue, I kind of likemd5
: it feels a little more descriptive. Then again, maybehash
would be better for consistency. Either one would work well from my perspective.The text was updated successfully, but these errors were encountered: