- 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/api/atom_api_download_item.cc
save_path_ = path;
}
base::FilePath DownloadItem::GetSavePath() const {
  return save_path_;
}
void DownloadItem::BuildPrototype(v8::Isolate* isolate,
                                  v8::Local<v8::FunctionTemplate> prototype) {
  prototype->SetClassName(mate::StringToV8(isolate, "DownloadItem"));
  mate::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate())
      .MakeDestroyable()
      .SetMethod("pause", &DownloadItem::Pause)
      .SetMethod("isPaused", &DownloadItem::IsPaused)
      .SetMethod("resume", &DownloadItem::Resume)
      .SetMethod("canResume", &DownloadItem::CanResume)
      .SetMethod("cancel", &DownloadItem::Cancel)
      .SetMethod("getReceivedBytes", &DownloadItem::GetReceivedBytes)
      .SetMethod("getTotalBytes", &DownloadItem::GetTotalBytes)
      .SetMethod("getMimeType", &DownloadItem::GetMimeType)
      .SetMethod("hasUserGesture", &DownloadItem::HasUserGesture)
      .SetMethod("getFilename", &DownloadItem::GetFilename)
      .SetMethod("getContentDisposition", &DownloadItem::GetContentDisposition)
      .SetMethod("getURL", &DownloadItem::GetURL)
      .SetMethod("getState", &DownloadItem::GetState)
      .SetMethod("isDone", &DownloadItem::IsDone)
      .SetMethod("setSavePath", &DownloadItem::SetSavePath)
      .SetMethod("getSavePath", &DownloadItem::GetSavePath);
}
mate::Handle<DownloadItem> DownloadItem::Create(