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

IQSS/10686 - fix dataset thumbnail #10687

Conversation

qqmyers
Copy link
Member

@qqmyers qqmyers commented Jul 15, 2024

What this PR does / why we need it: This PR resolves a recently (v6.3) introduced bug that can cause a dataset thumbnail to appear as a broken link and for a datafile to unnecessarily show the default icon rather than a thumb. Further details are in the issue.

Which issue(s) this PR closes:

Closes #10686

Special notes for your reviewer:
The fix is to send the real size (400) rather than 0 from the dataset.xhtml by adding the importConstants call to allow ImageThumbConverter.DEFAULT_PREVIEW_SIZE to be used. It appeared necessary to also add the final keyword to the constant in ImageThumbConverter for this to work, so I added final to all of them there. I also added a check to see if size==0 ever occurs and to avoid going through the logic that would set the persistent previewimagefail flag on the file.

To fix files where that flag has been set by this bug, one can call the /clearThumbnailFailureFlag api as described in the release note. I could add a flyway script for this, but the failure flag could have been set for other (real) reasons and doing so would cause all of those files to retry thumb generation on their next call. So rather than do that automatically, I though adding the api call (or letting people call it just for specific files) might be better. I don't have a strong opinion (we didn't have the fail flag not too long ago so retries were happening then.)

Strangely, this problem appears to be new at QDR (where #5621 came from) although the line of code in question was there already. I don't know what else might have changed - perhaps we are now catching the size==0 error and setting the flag whereas before that was a silent fail (only affecting the logic in the og header) and retry (showing a good thumb in pages).

Suggestions on how to test this:
I was able to trigger this by adding an image file, seeing the thumb created in the dataset, then going to the main page which triggers the logic to select a thumb for the dataset. Once that has happened, going back to the dataset page and making an edit, e.g. changing the metadata, causes the problem - I think the file thumb disappears immediately and going back to the main page/refreshing will cause the dataset thumb to show a broken link. Adding the PR should stop any new occurrences. To fix one that's broken, you have to call the /clearThumbnailFailureFlag as in the release note.
Does this PR introduce a user interface change? If mockups are available, please link/include them here:

Is there a release notes update needed for this change?:
included
Additional documentation:

@qqmyers qqmyers added Size: 3 A percentage of a sprint. 2.1 hours. Consider For Next Release A simple change (eg bug fix) that would be good to prioritize since it has been seen in the wild labels Jul 15, 2024
@coveralls
Copy link

coveralls commented Jul 15, 2024

Coverage Status

coverage: 20.733% (-0.006%) from 20.739%
when pulling 0ab5886 on QualitativeDataRepository:IQSS/10686-fix_dataset_thumbnail
into 2792cf9 on IQSS:develop.

@cmbz
Copy link

cmbz commented Jul 18, 2024

2024/07/18 - 6.4 proposal request from @poikilotherm

stevenwinship pushed a commit that referenced this pull request Sep 3, 2024
* This is the fix for the bug in its entirety. #10819

* Making dataset thumbnail auto-selection optional (but enabled by default) #10819

* release note for the PR. #10819

* added a size == 0 check to DatasetUtil.getThumbnail (copied from #10687) #10819

* Added instructions on how to fix the files and datasets affected by the bug
to the release note. #10819

* 2 extra words added to the release note #10819

* droped TIF from the error message in the thumbnail widgets, since it's not supported. (#10819)
IQSS/10686-fix_dataset_thumbnail
@qqmyers
Copy link
Member Author

qqmyers commented Sep 11, 2024

Since the same basic fix was in #10820, I'll close this.

@qqmyers qqmyers closed this Sep 11, 2024
PaulBoon pushed a commit to DANS-KNAW/dataverse that referenced this pull request Oct 2, 2024
* This is the fix for the bug in its entirety. IQSS#10819

* Making dataset thumbnail auto-selection optional (but enabled by default) IQSS#10819

* release note for the PR. IQSS#10819

* added a size == 0 check to DatasetUtil.getThumbnail (copied from IQSS#10687) IQSS#10819

* Added instructions on how to fix the files and datasets affected by the bug
to the release note. IQSS#10819

* 2 extra words added to the release note IQSS#10819

* droped TIF from the error message in the thumbnail widgets, since it's not supported. (IQSS#10819)

(cherry picked from commit 92d3839)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Consider For Next Release A simple change (eg bug fix) that would be good to prioritize since it has been seen in the wild Size: 3 A percentage of a sprint. 2.1 hours.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dataset thumbnail broken after metadata edit
4 participants