feat: add setting to support browser's "Prompt before download" option#156
Conversation
5233b8f to
b147c2e
Compare
ce20bbe to
3eaad4e
Compare
#136) Co-authored-by: Gautam krishna R <hello@gautamkrishnar.com>
3eaad4e to
5ebb127
Compare
|
Hey @aryanjsingh, thanks a lot for digging into this and identifying the root cause — the race condition with the 'Save As' dialog is a real issue and your analysis was spot on! 🙌 After looking at the fix, I'm going to try a slightly different approach: instead of a manual toggle in settings, it looks like we can auto-detect whether 'Prompt before download' is enabled by checking if I'll implement and test this approach. Once it's out, would love it if you could give it a try and confirm it fixes your issue! Thanks again for the contribution — really appreciate it. |
Summary
This fixes an issue where download interception fails if the browser's 'Prompt before download' setting is enabled. A new toggle has been added to the extension's settings page. When enabled, it delays pausing the download until after the user has confirmed the 'Save As' dialog, preventing a race condition that caused the browser to handle the download directly.
Changes
handleDownloadis updated. The initialpausecall is now conditional on a newpromptBeforeDownloadsetting. If the setting is true, the pause is delayed until afterwaitForFilenameresolves, preventing a race condition with the browser's 'Save As' dialog.promptBeforeDownload, is added to theDEFAULTSobject with a default value offalse. This allows the new setting to be stored and retrieved.Switchcomponent for thepromptBeforeDownloadsetting. This includes adding it toDEFAULTS, creating a state variable, and loading/saving its value.Related Issue
Closes #136