From f0c7d7c636fc9dd6e75cbdcdc0866eb06adc7959 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?France=CC=81=20Wilke?= <francewilke@gmail.com>
Date: Fri, 8 Sep 2023 08:54:51 +0200
Subject: [PATCH] Fix cleaning of the zone

---
 address_utils/address_utils.go | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/address_utils/address_utils.go b/address_utils/address_utils.go
index fca2ad9..375c156 100644
--- a/address_utils/address_utils.go
+++ b/address_utils/address_utils.go
@@ -240,11 +240,17 @@ func CleanZone(countryToClean, zoneToClean *string) (newCountry, newZone *string
 		zone := string_utils.RemoveAllWhiteSpaces(*zoneToClean)
 
 		for provinceCode, province := range Provinces {
+			found := false
 			for _, name := range province.Names {
 				if strings.ToLower(zone) == strings.ToLower(string_utils.RemoveAllWhiteSpaces(name)) {
-					zone = string_utils.ReplaceCaseInsensitive(zone, name, provinceCode)
+					zone = provinceCode
+					found = true
+					break
 				}
 			}
+			if found {
+				break
+			}
 		}
 
 		newZone = &zone
-- 
GitLab