Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Fixes saving a .torrent file
Browse files Browse the repository at this point in the history
Resolves #8146

Auditors: @bsclifton

Test Plan:
- Visit https://webtorrent.io/free-torrents/
- Click "Big Buck Bunny (torrent file)"
- Click "Save Torrent File..."
- File is saved
  • Loading branch information
NejcZdovc committed Apr 12, 2017
1 parent fa919c0 commit ac12268
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion app/browser/webtorrent.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const ipc = electron.ipcMain
const appUrlUtil = require('../../js/lib/appUrlUtil')
const messages = require('../../js/constants/messages')
const Filtering = require('../filtering')
const url = require('url')

// Set to see communication between WebTorrent and torrent viewer tabs
const DEBUG_IPC = false
Expand Down Expand Up @@ -60,7 +61,13 @@ function setupFiltering () {
return {}
}

var viewerUrl = getViewerURL(details.url)
const parsedUrl = url.parse(details.url)
const directDownload = parsedUrl && parsedUrl.query && parsedUrl.query.includes('download=true')
if (directDownload) {
return {}
}

const viewerUrl = getViewerURL(details.url)

return {
responseHeaders: {
Expand Down
1 change: 1 addition & 0 deletions js/webtorrent/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ function saveTorrentFile () {
let a = document.createElement('a')
a.target = '_blank'
a.download = true
a.href = `${store.torrentId}?download=true`
a.href = store.torrentId
a.click()
}
Expand Down

1 comment on commit ac12268

@bsclifton
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++

Please sign in to comment.