115: form attachments update for Central v2025.1, set content-type #116
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #115
{"success": True}What has been done to verify that this works as intended?
Added unit test to check the content-type change, ran integration tests to check generally. Opened forms created before the change (enketo OK, webforms errored) and after the change (enketo OK, webforms different probably unrelated error - details in #115).
Why is this the best possible solution? Were any other approaches considered?
This follows the attachment handling for submission attachments, which seems appropriate since it appears Central treats these attachment types in a similar way (in regards to S3 storage etc).
How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?
The API change should allow pyodk to upload forms with attachments with Central 2025.1 (or later). The content-type change should allow forms with attachments uploaded via pyodk to work with webforms.
I'm not aware of workarounds or fixes for file attachments (submissions or forms) that have inaccurate content-types saved for them (sending the same file again doesn't seem to overwrite).
Do we need any specific form for testing your changes? If so, please attach one.
The tests include the required files / data etc.
Does this change require updates to documentation? If so, please file an issue here and include the link below.
The form attachment upload method is not directly exposed by the pyodk API so it would not require a docs update.
Before submitting this PR, please make sure you have:
testspython -m unittestand verified all tests passruff format pyodk testsandruff check pyodk teststo lint code