Skip to content

Commit ad6317d

Browse files
Update Phone.py to detect leading dash
1 parent 52fb515 commit ad6317d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

plugins/Phone.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,17 @@ def check(self, tags):
146146
# Case 1: Prefix "-+" (e.g., "-+32...")
147147
if phone.startswith('-+'):
148148
phone_stripped = phone[2:]
149-
if self.InternationalPrefix and self.InternationalPrefix.match(phone_stripped):
149+
print(f"DEBUG: Case 1 - Stripped phone: {phone_stripped}")
150+
if phone_stripped.startswith(self.code + " "):
151+
print(f"DEBUG: Case 1 - Valid international number starting with country code: {phone_stripped}")
152+
err.append({"class": 30924, "subclass": stablehash64(tag), "text": T_("Bad international prefix"), "fix": {tag: "+" + phone_stripped}})
153+
continue
154+
elif self.InternationalPrefix and self.InternationalPrefix.match(phone_stripped):
155+
print(f"DEBUG: Case 1 - Valid international number: {phone_stripped}")
150156
err.append({"class": 30924, "subclass": stablehash64(tag), "text": T_("Bad international prefix"), "fix": {tag: "+" + phone_stripped}})
151157
continue
152158
elif self.MissingInternationalPrefix and self.MissingInternationalPrefix.match(phone_stripped):
159+
print(f"DEBUG: Case 1 - Valid local number: {phone_stripped}")
153160
err.append({"class": 30924, "subclass": stablehash64(tag), "text": T_("Bad international prefix"), "fix": {tag: "+" + self.code + " " + phone_stripped}})
154161
continue
155162
# Case 2: Prefix "-" before an international prefix (e.g., "-32...")

0 commit comments

Comments
 (0)