- Electron version: 1.3.5
- Operating system: macOS/Windows

Alt-clicking a link is a default shortcut for downloading a file without a save prompt, and we make use of it in our app. But for links that end in a trailing slash, the resulting filename isn't consistent with the default file name in the save prompt.

The save prompt constructs a name from the word "download" and the extension for the mime type of the file, but the prompt-less savepath is just the domain name of the link. This leads to unusable files (e.g. with a .com file extension) being saved to the filesystem.

Here's my current workaround, but given the prompt does get a useful path, and Chrome behaves correctly, I imagine this might be straightforward to fix if you know where to look:

``` javascript
const mime = require('mime-types');
const _ = require('lodash');
const path = require('path');
const unusedFilename = require('unused-filename');

win.webContents.session.on('will-download', function (e, item, webContents) {
  if (item.getSavePath() && _.last(item.getURL()) === '/') {
      var savePath = unusedFilename.sync(path.format({
        dir: path.dirname(item.getSavePath()),
        name: 'download',
        ext: '.' + mime.extension(item.getMimeType())
      }));
      item.setSavePath(savePath);
    }
});
```

atom/browser/atom_download_manager_delegate.cc
base::FilePath* path) {
  v8::Isolate* isolate = v8::Isolate::GetCurrent();
  v8::Locker locker(isolate);
  v8::HandleScope handle_scope(isolate);
  api::DownloadItem* download = api::DownloadItem::FromWrappedClass(isolate,
                                                                    item);
  if (download)
    *path = download->GetSavePath();
}
void AtomDownloadManagerDelegate::CreateDownloadPath(
    const GURL& url,
    const std::string& content_disposition,
    const std::string& suggested_filename,
    const std::string& mime_type,
    const base::FilePath& default_download_path,
    const CreateDownloadPathCallback& callback) {
  DCHECK_CURRENTLY_ON(content::BrowserThread::FILE);
  auto generated_name = net::GenerateFileName(url,
                                              content_disposition,
                                              std::string(),
                                              suggested_filename,
                                              mime_type,
                                              std::string());
  if (!base::PathExists(default_download_path))
    base::CreateDirectory(default_download_path);
  base::FilePath path(default_download_path.Append(generated_name));
  content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
                                   base::Bind(callback, path));
}
void AtomDownloadManagerDelegate::OnDownloadPathGenerated(