mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
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:
1 parent
870716b063
commit
e46d663d74
1 file changed
+1
-11
@@ -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
|
||||
|
||||
Reference in new issue
Block a user