create-torrent
Advanced tools
Comparing version 5.0.2 to 5.0.3
@@ -0,1 +1,8 @@ | ||
## [5.0.3](https://github.com/webtorrent/create-torrent/compare/v5.0.2...v5.0.3) (2022-07-03) | ||
### Bug Fixes | ||
* **deps:** update webtorrent ([#163](https://github.com/webtorrent/create-torrent/issues/163)) ([7f1fb98](https://github.com/webtorrent/create-torrent/commit/7f1fb980feddc9005bd5983ae893f47ebc12ede8)) | ||
## [5.0.2](https://github.com/webtorrent/create-torrent/compare/v5.0.1...v5.0.2) (2022-03-10) | ||
@@ -2,0 +9,0 @@ |
24
index.js
@@ -62,2 +62,4 @@ /*! create-torrent. MIT License. WebTorrent LLC <https://webtorrent.io/opensource> */ | ||
const pathSymbol = Symbol('itemPath') | ||
/** | ||
@@ -97,14 +99,14 @@ * Parse input file and return file information. | ||
item.path = path.split('/') | ||
item[pathSymbol] = path.split('/') | ||
// Remove initial slash | ||
if (!item.path[0]) { | ||
item.path.shift() | ||
if (!item[pathSymbol][0]) { | ||
item[pathSymbol].shift() | ||
} | ||
if (item.path.length < 2) { // No real prefix | ||
if (item[pathSymbol].length < 2) { // No real prefix | ||
commonPrefix = null | ||
} else if (i === 0 && input.length > 1) { // The first file has a prefix | ||
commonPrefix = item.path[0] | ||
} else if (item.path[0] !== commonPrefix) { // The prefix doesn't match | ||
commonPrefix = item[pathSymbol][0] | ||
} else if (item[pathSymbol][0] !== commonPrefix) { // The prefix doesn't match | ||
commonPrefix = null | ||
@@ -121,3 +123,3 @@ } | ||
} | ||
return !isJunkPath(item.path) | ||
return !isJunkPath(item[pathSymbol]) | ||
}) | ||
@@ -128,5 +130,5 @@ } | ||
input.forEach(item => { | ||
const pathless = (Buffer.isBuffer(item) || isReadable(item)) && !item.path | ||
const pathless = (Buffer.isBuffer(item) || isReadable(item)) && !item[pathSymbol] | ||
if (typeof item === 'string' || pathless) return | ||
item.path.shift() | ||
item[pathSymbol].shift() | ||
}) | ||
@@ -146,3 +148,3 @@ } | ||
} else if (!item.unknownName) { | ||
opts.name = item.path[item.path.length - 1] | ||
opts.name = item[pathSymbol][item[pathSymbol].length - 1] | ||
return true | ||
@@ -200,3 +202,3 @@ } | ||
} | ||
file.path = item.path | ||
file.path = item[pathSymbol] | ||
cb(null, file) | ||
@@ -203,0 +205,0 @@ }), (err, files) => { |
{ | ||
"name": "create-torrent", | ||
"description": "Create .torrent files", | ||
"version": "5.0.2", | ||
"version": "5.0.3", | ||
"author": { | ||
@@ -21,3 +21,3 @@ "name": "WebTorrent LLC", | ||
"dependencies": { | ||
"bencode": "^2.0.2", | ||
"bencode": "^2.0.3", | ||
"block-stream2": "^2.1.0", | ||
@@ -39,6 +39,6 @@ "filestream": "^5.0.0", | ||
"brfs": "2.0.2", | ||
"parse-torrent": "9.1.4", | ||
"semantic-release": "19.0.2", | ||
"parse-torrent": "9.1.5", | ||
"semantic-release": "19.0.3", | ||
"standard": "*", | ||
"tape": "5.5.2", | ||
"tape": "5.5.3", | ||
"webtorrent-fixtures": "1.7.5" | ||
@@ -45,0 +45,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26240
518
Updatedbencode@^2.0.3