Create Torrent: fix for single file torrents

This commit is contained in:
DC
2016-04-27 04:01:18 -07:00
parent 3d4d1c8650
commit 017d61815f

View File

@@ -41,7 +41,9 @@ function CreateTorrentPage (state) {
// Then, use the name of the base folder (or sole file, for a single file torrent)
// as the default name. Show all files relative to the base folder.
var defaultName = path.basename(pathPrefix)
var defaultName = files.length === 1
? files[0].name
: path.basename(pathPrefix)
var basePath = path.dirname(pathPrefix)
var maxFileElems = 100
var fileElems = files.slice(0, maxFileElems).map(function (file) {