From 4f8585178af78f8f64c5ca38e923c306613278b9 Mon Sep 17 00:00:00 2001 From: Brian Kurek Date: Sat, 27 Apr 2019 14:25:01 -0400 Subject: [PATCH] Ignore potentially unsafe files --- lib/parse.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/parse.js b/lib/parse.js index 600ad782..fdcdd7d4 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -38,6 +38,7 @@ function Parse () { me._stream = new BlockStream(512) me.position = 0 me._ended = false + me._entries = [] me._stream.on("error", function (e) { me.emit("error", e) @@ -250,7 +251,16 @@ Parse.prototype._startEntry = function (c) { if (onend) entry.on("end", onend) + if (entry.type === "File") { + this._entries.forEach(function(prevEntry) { + if (prevEntry.type === "Link" && prevEntry.path === entry.path) { + ev = "ignoredEntry" + } + }) + } + this._entry = entry + this._entries.push(entry) var me = this entry.on("pause", function () {