10

I don't want to see that Discard/Keep dialog when downloading a pdf file in browser. I just want it to automatically save to my default location. I'm using chrome on Ubuntu 13.04.

enter image description here

5

I fear that the only way to disable this is to patch Chrome.

The file that contains the blacklist is /src/chrome/browser/download/download_extensions.cc.

One would just need to remove the line containing { "pdf", AllowOnUserGesture }, and recompile.


Or replace DownloadDangerLevel GetFileDangerLevel(const base::FilePath& path) with:

DownloadDangerLevel GetFileDangerLevel(const base::FilePath& path) {
  return NotDangerous;
}

which seems to have some irony to it.


UPDATE: I wrote a patch and have successfully tested it.

--- chromium-26.0.1410.43-old/chrome/browser/download/download_extensions.cc    2013-03-21 21:14:04.000000000 -0400
+++ chromium-26.0.1410.43-new/chrome/browser/download/download_extensions.cc    2013-06-04 11:51:40.000000000 -0400
@@ -213,6 +213,7 @@
 };

 DownloadDangerLevel GetFileDangerLevel(const base::FilePath& path) {
+  return NotDangerous;
   base::FilePath::StringType extension(path.Extension());
   if (extension.empty())
     return NotDangerous;

If on Gentoo, you can just place this in a file in /etc/portage/patches/www-client/chromium/ and emerge chromium.

| improve this answer | |
5

I have a solution which worked on Windows 10. The issue can be fixed by editing "download_file_types.pb" which is located in my computer at

%localappdata%\Google\Chrome\User Data\FileTypePolicies\21\download_file_types.pb

The file contains various file extensions. Just hexedit the file and remove the extension you want chrome to ignore. e.g. I wanted to download *.mat files, so I searched for 'mat' and replaced it with 'xxx'

This worked for me. Make backups as it is just a workaround.

| improve this answer | |
  • how do we do it on macOS? – ikel Sep 11 at 3:10
1

You can disable this feature through the Advanced Settings option in Chrome Settings. (Please see the screenshot below.) Unfortunately, it's not very granular because disabling it also disables other safe browsing features. Picture of disabling safe browsing. You perhaps could disable safe browsing if you need to download a number of files that you know to be safe, and then you could re-enable safe browsing afterwards.

| improve this answer | |
  • This did not work for me. Only editing the download_file_types.pb file did the trick. – jous Apr 7 at 6:08
  • 1
    this did not work for me either – ikel Sep 11 at 3:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.