fix(geo): return raw country code without locale-dictionary validation

Previously getCountryCode() returned '--' when the raw code wasn't in
Appwrite's locale translations dictionary, while isEmpty() checked the
raw stored value — the mismatch let the console country denylist
silently bypass any country not translated in Appwrite (Antarctica,
recently-created ISO codes, etc.). Country code is a machine-readable
identifier; locale translation is only relevant for getCountryName().
This commit is contained in:
Damodar Lohani committed 2026-07-06 03:06:24 +00:00
1 parent 870716b063
commit e46d663d74
1 file changed
+1 -11
+1 -11
View File
@@ -49,17 +49,7 @@ class GeoRecord extends Document
{
$code = $this->getAttribute('countryCode', '--');
if ($code === '--') {
return '--';
}
$upper = \strtoupper($code);
if ($this->locale === null) {
return $upper;
}
return $this->locale->getText('countries.' . \strtolower($upper), false) ? $upper : '--';
return $code === '--' ? '--' : \strtoupper($code);
}
public function getCountryName(): string