From f05a347281f1ce687edd9bd3694c89486515ac84 Mon Sep 17 00:00:00 2001
From: deuce <>
Date: Sat, 16 Jan 2016 01:35:58 +0000
Subject: [PATCH] More explicity and easy to read code for determining if the
 zone extension is required.

---
 exec/load/fido.js | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/exec/load/fido.js b/exec/load/fido.js
index d6d49425ba..d7098d2db9 100644
--- a/exec/load/fido.js
+++ b/exec/load/fido.js
@@ -226,8 +226,21 @@ FIDO.Addr.prototype.flo_outbound = function(default_zone, default_domain)
 	// backslash() doesn't work on an empty string
 	var ret = '_';
 
-	if (this.zone !== undefined && (( default_domain !== undefined && this.domain !== default_domain.toLowerCase()) || this.zone !== default_zone))
-		ret += format(".%03x", this.zone);
+	/*
+	 * We need the zone suffix if:
+	 * 1) This is not in the default zone.
+	 * -OR-
+	 * 2) This is not in the default domain.
+	 *
+	 * If default_* is undefined, assume we are in the default.
+	 * Of course, if we don't have a zone, we surely can't put it in.
+	 */
+
+	if (this.zone !== undefined) {
+		if (default_zone !== undefined && this.zone !== default_zone) ||
+				(this.domain !== undefined && default_domain !== undefined && this.domain !== default_domain.toLowerCase())
+			ret += format(".%03x", this.zone);
+	}
 	ret = backslash(ret);
 	if (this.point !== undefined)
 		ret += backslash(format("%08x.pnt", this.point));
-- 
GitLab