diff --git a/static/js/create.js b/static/js/create.js index 175c658..421cbd3 100644 --- a/static/js/create.js +++ b/static/js/create.js @@ -56,13 +56,16 @@ function fillDetectedFilelist(file) { filesGroup = document.querySelectorAll(".filesGroup")[0] if(torrentObject["info"]["files"] != undefined && torrentObject["info"]["files"].length > 0) { + // render the file-tree if multiple files are present autodetectSuccess = true - rootElement = document.createElement("div") for(var fileIndex = 0; fileIndex < torrentObject.info.files.length; fileIndex++){ path = torrentObject["info"]["files"][fileIndex]["path"] renderFile(getRoot(), path.reverse()) } - + } else { + // assume the torrent is only one file named "name" + autodetectSuccess = true + renderFile(getRoot(), [torrentObject["info"]["name"]]) } var detectInfosGroup = document.querySelectorAll(".detectedInfosGroup")[0]