Skip to content

feat: add setting to support browser's "Prompt before download" option#156

Closed
aryanjsingh wants to merge 1 commit intogautamkrishnar:masterfrom
aryanjsingh:fix/issue-136-prompt-before-download-is-not-working
Closed

feat: add setting to support browser's "Prompt before download" option#156
aryanjsingh wants to merge 1 commit intogautamkrishnar:masterfrom
aryanjsingh:fix/issue-136-prompt-before-download-is-not-working

Conversation

@aryanjsingh
Copy link
Copy Markdown

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

  • app/scripts/background.js: The download handling logic in handleDownload is updated. The initial pause call is now conditional on a new promptBeforeDownload setting. If the setting is true, the pause is delayed until after waitForFilename resolves, preventing a race condition with the browser's 'Save As' dialog.
  • app/scripts/services/SettingsCache.js: A new setting, promptBeforeDownload, is added to the DEFAULTS object with a default value of false. This allows the new setting to be stored and retrieved.
  • app/scripts/config.js: The settings page is updated to include a new Switch component for the promptBeforeDownload setting. This includes adding it to DEFAULTS, creating a state variable, and loading/saving its value.

Related Issue

Closes #136

@gautamkrishnar gautamkrishnar force-pushed the master branch 3 times, most recently from 5233b8f to b147c2e Compare April 3, 2026 22:14
@gautamkrishnar gautamkrishnar force-pushed the fix/issue-136-prompt-before-download-is-not-working branch 4 times, most recently from ce20bbe to 3eaad4e Compare April 4, 2026 00:52
@gautamkrishnar gautamkrishnar changed the title fix: Add setting to support browser's "Prompt before download" feat: add setting to support browser's "Prompt before download" option Apr 4, 2026
#136)

Co-authored-by: Gautam krishna R <hello@gautamkrishnar.com>
@gautamkrishnar gautamkrishnar force-pushed the fix/issue-136-prompt-before-download-is-not-working branch from 3eaad4e to 5ebb127 Compare April 4, 2026 00:53
@gautamkrishnar
Copy link
Copy Markdown
Owner

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 downloadItem.filename is empty when onCreated fires. Chrome only sets the filename after the user confirms the dialog, so this should work reliably without requiring any user configuration.

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.

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.

Prompt before download is not working

2 participants