From 18442debb743d36400efe5efc1ad347bf14ab6ce Mon Sep 17 00:00:00 2001 From: JunesiPhone Date: Tue, 26 Mar 2019 15:43:17 -0500 Subject: [PATCH] Escape symbols for city. Some cities have ' --- Tweak/Weather/XIWeather.m | 10 ++++++---- control | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Tweak/Weather/XIWeather.m b/Tweak/Weather/XIWeather.m index 5ccb39a..252acef 100644 --- a/Tweak/Weather/XIWeather.m +++ b/Tweak/Weather/XIWeather.m @@ -195,9 +195,9 @@ - (NSString*)_variablesToJSString { @"hourIndex": [NSNumber numberWithInt:hourForecast.hourIndex] }]; } - + NSDictionary *weatherInfo = @{ - @"city": self.currentCity.name != nil ? self.currentCity.name : @"Local Weather", + @"city": [self _escapeString:self.currentCity.name] != nil ? [self _escapeString:self.currentCity.name] : @"Local Weather", @"address": self.reverseGeocodedAddress ? self.reverseGeocodedAddress : @{}, @"temperature": [NSNumber numberWithInt:temp], @"low": dailyForecasts.count > 0 ? [dailyForecasts[0] objectForKey:@"low"] : @0, @@ -228,7 +228,7 @@ - (NSString*)_variablesToJSString { @"precipitation24hr": [NSNumber numberWithFloat:self.currentCity.precipitationPast24Hours], @"heatIndex": [NSNumber numberWithInt:(int)roundf(self.currentCity.heatIndex)], @"moonPhase": [NSNumber numberWithInt:(int)roundf(self.currentCity.moonPhase)], - @"cityState": self.currentCity.cityAndState != nil ? self.currentCity.cityAndState : @"" + @"cityState": [self _escapeString:self.currentCity.cityAndState] != nil ? [self _escapeString:self.currentCity.cityAndState] : @"" }; NSString * jsonObj = [[NSString alloc] initWithData:[NSJSONSerialization dataWithJSONObject:weatherInfo @@ -243,7 +243,9 @@ - (NSString*)_escapeString:(NSString*)input { if (!input) return @""; - input = [input stringByReplacingOccurrencesOfString:@"'" withString:@"\\'"]; + input = [input stringByReplacingOccurrencesOfString:@"'" withString:@"'"]; + input = [input stringByReplacingOccurrencesOfString:@"&" withString:@"&"]; + input = [input stringByReplacingOccurrencesOfString:@"+" withString:@"+"]; input = [input stringByReplacingOccurrencesOfString: @"\"" withString:@"\\\""]; input = [input stringByReplacingOccurrencesOfString: @"/" withString:@"\\/"]; diff --git a/control b/control index 3ad8f86..e6b2d2f 100644 --- a/control +++ b/control @@ -1,7 +1,7 @@ Package: com.junesiphone.xeninfo Name: XenInfo Depends: mobilesubstrate, firmware (>= 9.0) -Version: 2.2.1 +Version: 2.2.2 Conflicts: org.bigboss.datameter, cydia.kiiimo.org.datameter, com.repo.xarold.com.datameter, re.rejail.datameter, org.coolstar.ventana-modern, com.repo.xarold.com.ventana, cydia.kiiimo.org.ventana Architecture: iphoneos-arm Description: Music, Weather, and battery info for XenHTML