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

Only add image to answer where the sessions match #2005

Merged
merged 1 commit into from Sep 9, 2021

Conversation

jmsmkn
Copy link
Member

@jmsmkn jmsmkn commented Sep 9, 2021

As answer image types are editable it could be the case that there are multiple pending upload sessions for an answer at the same time. The value of the latest upload session pk is always stored in the answer. As the upload sessions may be processed out of order (no FIFO guarantees) this PR only allows the image to be assigned to the answer if it originates from the session expected by the answer. Older versions of the answer_image are still saved and tracable through the answer history.

@codecov
Copy link

codecov bot commented Sep 9, 2021

Codecov Report

Merging #2005 (3a2a474) into master (39f753f) will increase coverage by 0.00%.
The diff coverage is 66.66%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2005   +/-   ##
=======================================
  Coverage   93.25%   93.25%           
=======================================
  Files         683      683           
  Lines       26006    26008    +2     
=======================================
+ Hits        24252    24254    +2     
  Misses       1754     1754           
Impacted Files Coverage Δ
app/grandchallenge/reader_studies/tasks.py 97.14% <66.66%> (-2.86%) ⬇️
app/grandchallenge/components/models.py 92.21% <0.00%> (+0.29%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 39f753f...3a2a474. Read the comment docs.

Copy link
Contributor

@miriam-groeneveld miriam-groeneveld left a comment

Choose a reason for hiding this comment

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

Looks good to me. Didn't know about casefold()

@jmsmkn
Copy link
Member Author

jmsmkn commented Sep 9, 2021

Yes, this is the way to do caseless string comparison, nasty things can happen otherwise:

https://eng.getwisdom.io/hacking-github-with-unicode-dotless-i/
https://www.djangoproject.com/weblog/2019/dec/18/security-releases/

@jmsmkn jmsmkn merged commit 6f0d160 into master Sep 9, 2021
@jmsmkn jmsmkn deleted the answer_image_upload branch September 9, 2021 13:19
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.

None yet

2 participants