From 6550c04650ace999472a1cd8713d7b6ce983d044 Mon Sep 17 00:00:00 2001 From: icylogic Date: Thu, 1 Oct 2015 00:16:53 +0800 Subject: [PATCH] escape comma for csv; prevent a bug --- .../Controller/Service/AvailabilityStatistics.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/shadowsocks-csharp/Controller/Service/AvailabilityStatistics.cs b/shadowsocks-csharp/Controller/Service/AvailabilityStatistics.cs index 7bc2500e..49820f63 100644 --- a/shadowsocks-csharp/Controller/Service/AvailabilityStatistics.cs +++ b/shadowsocks-csharp/Controller/Service/AvailabilityStatistics.cs @@ -83,7 +83,7 @@ namespace Shadowsocks.Controller { Logging.Debug("Retrive information of geolocation and isp"); const string API = "http://ip-api.com/json"; - const string alternativeAPI = "http://www.telize.com/geoip"; //must be compatible with current API + const string alternativeAPI = "http://www.telize.com/geoip"; //must be comptible with current API var result = await GetInfoFromAPI(API); if (result != null) return result; result = await GetInfoFromAPI(alternativeAPI); @@ -114,8 +114,8 @@ namespace Shadowsocks.Controller string isp = obj["isp"]; if (country == null || city == null || isp == null) return null; return new DataList { - new DataUnit(State.Geolocation, $"{country} {city}"), - new DataUnit(State.ISP, isp) + new DataUnit(State.Geolocation, $"\"{country} {city}\""), + new DataUnit(State.ISP, $"\"{isp}\"") }; } @@ -206,6 +206,7 @@ namespace Shadowsocks.Controller private async void FilterRawStatistics() { + if (RawStatistics == null) return; if (FilteredStatistics == null) { FilteredStatistics = new Statistics();