From add7bab0ddab8d867ab6c754c627892f21c59b03 Mon Sep 17 00:00:00 2001
From: Rob Swindell <rob@synchro.net>
Date: Sat, 21 Jan 2023 16:24:53 -0800
Subject: [PATCH] Treat 0-byte QW* files the same as non-existent

The SBBS event_thread ignores 0-byte QW* files, so we should here as well
(just overwrite them if they exist), otherwise, if 10 0-byte QW* files got
created, we would just stop downloading QWK packets indefinitely.

Fixes issue reported by deon (ALTERANT) on DOVE-Net.
---
 exec/qnet-ftp.js | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/exec/qnet-ftp.js b/exec/qnet-ftp.js
index 974ff896ec..e7207802ca 100644
--- a/exec/qnet-ftp.js
+++ b/exec/qnet-ftp.js
@@ -1,4 +1,3 @@
-// $Id: qnet-ftp.js,v 1.4 2020/05/22 06:58:34 rswindell Exp $
 //****************************************************************************
 //	  JavaScript module for performing FTP-based QWKnet call-outs
 //    Inspired by exec/qnet-ftp.src
@@ -8,7 +7,7 @@
 // Usage: ?qnet-ftp <hub-id> [address] [password] [port]
 // Example: ?qnet-ftp VERT vert.synchro.net YOURPASS 21
 
-const REVISION = "$Revision: 1.4 $".split(' ')[1];
+const REVISION = "1.5";
 
 require('ftp.js', 'FTP');
 
@@ -30,11 +29,11 @@ var qwk_fname = system.data_dir + qwk;
 
 log(LOG_DEBUG, js.exec_file + " v" + REVISION);
 
-if(file_getcase(qwk_fname)) {
+if(file_size(qwk_fname) > 0) {
 	alert(qwk_fname + " already exists");
 	for(var i = 0; ; i++) {
 		qwk_fname = system.data_dir + hubid + ".qw" + i;
-		if(!file_getcase(qwk_fname))
+		if(file_size(qwk_fname) < 1)
 			break;
 		alert(qwk_fname + " already exists");
 		if(i == 9)
-- 
GitLab