Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Collect should not attempt to redownload media file if it has the same hash as the last download #6030

Open
4 tasks
Tracked by #5991
seadowg opened this issue Mar 22, 2024 · 0 comments
Open
4 tasks
Tracked by #5991
Milestone

Comments

@seadowg
Copy link
Member

seadowg commented Mar 22, 2024

Collect currently redownloads a media file if the hash in the response does not match the calculated MD5 hash of the file it already has. This doesn't quite match the spec:

If the hash value identified in the manifest differs from the hash value for a previously-downloaded media file, then the file should be re-fetched from the server.

Really, Collect should compare the hash in the manifest response against the manifest response form the previous time it downloaded the file rather than use the file itself as the spec does not explicitly state that the hash (with an md5 prefix) is originated from the file contents (it just happens to be the case most of the time). This is specifically a problem for Central's entity list media files which return a hash that will reflect whether the entity list has changed or not, but is not derived from the CSV file.

The actual impact of this problem is lowered by the fact that we use HTTP caching and the redownload of the same file will often be caught there.

Acceptance (using Central)

  • Given I'm using a project with an entity follow up form
    And I've previously downloaded the form
    And I've cleared the app's cache (in app settings)
    When I update forms
    Then the entity list is not redownloaded

  • Given I'm using a project with an entity follow up form
    And I've previously downloaded the form
    And I've cleared the app's cache (in app settings)
    When the entity list is updated
    And I update forms
    Then the entity list is redownloaded

  • Given I'm using a project with a form that has a media file
    And I copy the form and media file onto device instead of downloading them
    When I update the form
    Then the media file is redownloaded

  • Given I'm using a project with a form that has a media file
    And I've downloaded the form
    And I've cleared the app's cache (in app settings)
    When I update the form
    Then the media file is not redownloaded

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
Status: later
Development

No branches or pull requests

1 participant