diff --git a/frontend/components/WebRtcTest.vue b/frontend/components/WebRtcTest.vue index a311d690..a7ac7a5c 100644 --- a/frontend/components/WebRtcTest.vue +++ b/frontend/components/WebRtcTest.vue @@ -203,7 +203,10 @@ const fetchCountryCode = async (ip) => { if (ipData) { let country_code = ipData.country_code.toLowerCase(); - let country = getCountryName(ipData.country_code, lang.value); + let country = ipData.country_code || 'N/A'; + if (country !== 'N/A') { + country = getCountryName(ipData.country_code, lang.value); + } return [country_code, country]; } } catch (error) { diff --git a/frontend/utils/transform-ip-data.js b/frontend/utils/transform-ip-data.js index fbf7e4db..9b507201 100644 --- a/frontend/utils/transform-ip-data.js +++ b/frontend/utils/transform-ip-data.js @@ -6,7 +6,7 @@ function transformDataFromIPapi(data, ipGeoSource, t, bingMapLanguage) { const baseData = { country_name: data.country_name || "", - country_code: data.country || "", + country_code: data.country === 'N/A' ? '' : data.country, region: data.region || "", city: data.city || "", latitude: data.latitude || "",