-
Notifications
You must be signed in to change notification settings - Fork 36
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
Ensure files are only downloaded once #4404
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Google Chrome (Version 120.0.6099.216 (Official Build) (arm64))
- Exporting Query Results (when at least one result is selected)
- Downloading Statistics as TSV
- Downloading an AppResource
- Downloading a Viewset
- Downloading the content of the Crash Report Visualizer as HTML
- Accessible by navigating to /specify/developer/crash-report-visualizer
- Downloading System/Specify information from the About Specify page
- Downloading the Specify datamodel/schema from the Database Schema page
Firefox (Version 120.0.1 (64-bit))
- Exporting Query Results (when at least one result is selected)
- Downloading Statistics as TSV
- Downloading an AppResource
- Downloading a Viewset
- Downloading the content of the Crash Report Visualizer as HTML
- Accessible by navigating to /specify/developer/crash-report-visualizer
- Downloading System/Specify information from the About Specify page
- Downloading the Specify datamodel/schema from the Database Schema page
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, now that makes sense
another mystery solved - thanks!
Also, see my ominous warning 😈: specify7/specifyweb/frontend/js_src/lib/components/Molecules/FilePicker.tsx Lines 119 to 120 in 1e9be50
I just couldn't find any other way that didn't involve back-end, didn't force HTTPs, gave us control over the file name, didn't require third-party libraries, and worked accorss browsers (somewhat) |
Which release will this be included with? @CarolineDenis @melton-jason This seems like another PR that can be included in 7.9.3, though I don't want to be expand the scope if you feel it would be better to add in 7.9.4. |
This pull request has been mentioned on Specify Community Forum. There might be relevant details there: https://discourse.specifysoftware.org/t/specify-7-9-3-release-announcement/1499/1 |
Fixes #2638
The issue here is that for certain browsers the
load
event was being triggered twice where theiframe.contentWindow
was not nullspecify7/specifyweb/frontend/js_src/lib/components/Molecules/FilePicker.tsx
Lines 136 to 153 in 1e9be50
The load event was being fired and caught both when the
iframe
was appended to the document and when the content within the iframe was being closed. In both cases theiframe.contentWindow
was not null, so the initial return was never caught and theelement.click()
was called twice.specify7/specifyweb/frontend/js_src/lib/components/Molecules/FilePicker.tsx
Lines 155 to 158 in 1e9be50
Checklist
and self-explanatory (or properly documented)
Testing instructions
In each of Google Chrome, Firefox, and Safari, try actions which would download a file directly, not using the Notification system.
(#2638 did not affect files downloaded from the notification system)
Here are a few places in Specify where this can be accomplished:
(This likely do not all need to be tested, as they all utilize the same
downloadFile
function for functionality)/specify/developer/crash-report-visualizer
If other browsers are tested, please mention them in your comment.