- 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_web_contents.cc
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/resource_request_details.h"
#include "content/public/browser/service_worker_context.h"
#include "content/public/browser/site_instance.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/context_menu_params.h"
#include "native_mate/dictionary.h"
#include "native_mate/object_template_builder.h"
#include "net/http/http_response_headers.h"
#include "net/url_request/url_request_context.h"
#include "third_party/WebKit/public/web/WebFindOptions.h"
#include "third_party/WebKit/public/web/WebInputEvent.h"
#include "ui/display/screen.h"
#if !defined(OS_MACOSX)
#include "ui/aura/window.h"
#endif
#include "atom/common/node_includes.h"
namespace {
struct PrintSettings {
  bool silent;
  bool print_background;
};
}  
namespace mate {
template<>
struct Converter<atom::SetSizeParams> {
  static bool FromV8(v8::Isolate* isolate,