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

allow most recent version of file to be downloaded. #4336

Merged
merged 1 commit into from
May 26, 2020
Merged

Conversation

blancoj
Copy link
Contributor

@blancoj blancoj commented May 26, 2020

Fixes #4274

When a depositor or an admin wants to add a new version of a file, they download the file, edit it and upload it back as a new version. After uploading the new version, they download it to check it. Before this change, hyrax downloaded the old version. After this PR, it downloads the most recent change.

The reason this was happening was because date_modified was not being updated when a new version was being uploaded. The call to update_metadata ensures that the modified_date is updated. This date is used to build the header when downloading, specifically the Last-Modified portion of the header. The browser then knows that when this date has changed, it does not use the cache.

Guidance for testing, such as acceptance criteria or new user interface behaviors:

  • Download a txt file attached to a work
  • Edit it
  • Go to the Version option for the files, upload the new version
  • Check the new version is uploaded in the version history
  • Click on Download this file button, and it should download the most recent version of the file and not previous uploaded version.

@samvera/hyrax-code-reviewers

Copy link
Contributor

@no-reply no-reply left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome! this looks like a big improvement.

would you mind looping back and adding a matching controller test?

@no-reply
Copy link
Contributor

candidate for backport to 2.x-stable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding a new version of a file does not work until browser cache is refreshed
2 participants