Media files not accessible after editing (API and UI)

Description

Submissions which include media files are shown in the API as in the picture below.

Media files can be accessed via ‘_attachments’ ‘filename’.

As soon as the original submission is edited and re-submitted, the API shows the following:

The ‘_uuid’-part of ‘filename’ has changed following the change of the ‘_uuid’ itself.
As a result, the link to the ‘_attachments’ ‘filename’ does not work anymore, because the media file seems to remain at its original place. This can be proven by applying the link of the original submission, which still works.

(As a workaround, you may replace the ‘_uuid’-part with the tag ‘meta/depreciatedID’, but after a second re-submission the reference to the original is definitely not available anymore.)

Steps to Reproduce

  1. Test the link of the original submission, generated from ‘attachments’ ‘filename’ – you may access the media file (keep the link for later)

  2. Edit any field of the submission (of course except the media file itself) and resubmit it.

  3. Test the link of the re-submitted record, again generated from the new parameters of ‘attachments’ ‘filename’ – access to the media file will fail.

  4. Use the link from the original submission. – It will work.

  5. Download (Export media attachments (zip)) via UI: while the mediafiles of unedited submissions will be exported as expected, the mediafiles of edited(re-submitted) submissions will be missing in the zip-file.

Expected behavior

It is intended to generate the link to media files using ‘_attachments’ ‘filename’ even after resubmission of records.
UI-generated exports should include all files, including those of edited submissions.

Actual behavior

After re-submission (editing), the link to the media file is incorrect. The correct link remains the same as for the original submission.

Your environment:

The forms are at on https://eu.kobotoolbox.org.

The tests were conducted from various computers and different users. We’ve also tried with different forms and different form-owners. The result is the same in all environments.

1 Like

@jps, so you mean once the submissions with the media files are edited you are not able to download Media ZIP files from the UI (for those submissions you edited). Did I get you correctly?

Yes,
Thats exactly the point,
This applies to all methods using the API as described in my initial post.
(e.g. Downloading Photos and Other Media — KoboToolbox documentation or GitHub - joshuaberetta/kobomedia )

I don’t know how the UI generates the media-export, but edited submissions are missing in the zip-file, so I can just assume it might be related to the same issue.