jscrambler
Advanced tools
Comparing version 0.5.3 to 0.5.4
@@ -217,2 +217,3 @@ /** | ||
var hasFiles = false; | ||
// If it's already a zip file | ||
if (files.length === 1 && /^.*\.zip$/.test(files[0])) { | ||
@@ -224,4 +225,15 @@ hasFiles = true; | ||
for (var i = 0, l = files.length; i < l; ++i) { | ||
// Sanitise path | ||
if (typeof files[i] === 'string') { | ||
files[i] = path.normalize(files[i]); | ||
if (files[i].indexOf('../') === 0) { | ||
files[i] = path.resolve(files[i]); | ||
} | ||
} | ||
// Bypass unwanted patterns from `files` | ||
if (/.*\.(git|hg)(\/.*|$)/.test(files[i].path || files[i])) { | ||
continue; | ||
} | ||
var buffer, name; | ||
var path = cwd ? cwd + '/' + files[i] : files[i]; | ||
var sPath = cwd ? cwd + '/' + files[i] : files[i]; | ||
// If buffer | ||
@@ -233,9 +245,9 @@ if (files[i].contents) { | ||
// Else if it's a path and not a directory | ||
else if (!fs.statSync(path).isDirectory()) { | ||
else if (!fs.statSync(sPath).isDirectory()) { | ||
name = files[i]; | ||
buffer = fs.readFileSync(path); | ||
buffer = fs.readFileSync(sPath); | ||
} | ||
// Else if it's a directory path | ||
else { | ||
zip.folder(path); | ||
zip.folder(sPath); | ||
} | ||
@@ -242,0 +254,0 @@ if (name) { |
{ | ||
"name": "jscrambler", | ||
"description": "JScrambler API client.", | ||
"version": "0.5.3", | ||
"version": "0.5.4", | ||
"homepage": "https://github.com/auditmark/node-jscrambler", | ||
@@ -6,0 +6,0 @@ "author": { |
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
25806
474