From c73f9bdb0aee3bb438edd2e5568a1715f74e4fc4 Mon Sep 17 00:00:00 2001
From: Rob Swindell <--global>
Date: Sun, 1 Nov 2020 13:37:56 -0800
Subject: [PATCH] Fix up the unzip command-line introduced in mlong's
 enhancements

1. You can't include % specifiers in the string passed to system.exec()
   - this is just a wrapper for system(), it doesn't recongize Synchronet
     command-line specifiers.
   - so I just prepend the exec_dir for Win32, leave off for *nix.
   - it appears this wasn't tested since that command-line would not work.

2. Added 'j' option to unzip. We don't want the extraction of infopacks with
   sub-directories to be creating sub-directories under our ctrl dir.
   We should consider extracting to a temp dir instead of the ctrl dir if
   we don't have absolute control over what's being extracted from downloaded
   zip files. This could be dangerous if we're not extremely careful.
---
 exec/init-fidonet.js | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/exec/init-fidonet.js b/exec/init-fidonet.js
index 622fd946d9..fd26252dae 100644
--- a/exec/init-fidonet.js
+++ b/exec/init-fidonet.js
@@ -700,8 +700,11 @@ if(network.echolist
 			file.write(contents);
 			file.close();
 
-			// try to extract on linux,
-			if (system.exec("%@unzip -CLo " + file_getname(network.pack) + " " + echolist_fname) !== 0) {
+			// try to extract
+			var prefix = "";
+			if(system.platform == "Win32")
+				prefix = system.exec_dir;
+			if (system.exec(prefix + "unzip -CLjo " + file_getname(network.pack) + " " + echolist_fname) !== 0) {
 				print("Please extract " + network.echolist + " from " + file.name + " into " + system.ctrl_dir);
 			}
 
-- 
GitLab