diff options
Diffstat (limited to 'lib/zipfile.js')
| -rw-r--r-- | lib/zipfile.js | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/zipfile.js b/lib/zipfile.js index ae51310..8d46d92 100644 --- a/lib/zipfile.js +++ b/lib/zipfile.js @@ -51,7 +51,19 @@ function splitPath(path) { } function joinPath() { - return Array.prototype.filter.call(arguments, function(path) { + var nonEmptyPaths = Array.prototype.filter.call(arguments, function(path) { return path; - }).join("/"); + }); + + var relevantPaths = []; + + nonEmptyPaths.forEach(function(path) { + if (/^\//.test(path)) { + relevantPaths = [path]; + } else { + relevantPaths.push(path); + } + }); + + return relevantPaths.join("/"); } |
