From f8ef9608dce2a71a38752dcfeac546ffdcf32603 Mon Sep 17 00:00:00 2001 From: Zorg Date: Mon, 24 May 2021 00:41:46 -0700 Subject: [PATCH] Fix warning from using -stringByAddingPercentEscapesUsingEncoding: --- Sparkle/SPUUpdater.m | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Sparkle/SPUUpdater.m b/Sparkle/SPUUpdater.m index 206776e4..67e152b4 100644 --- a/Sparkle/SPUUpdater.m +++ b/Sparkle/SPUUpdater.m @@ -769,10 +769,9 @@ NSString *const SUUpdaterAppcastNotificationKey = @"SUUpdaterAppCastNotification } static NSString *escapeURLComponent(NSString *str) { - return [[[[str stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding] - stringByReplacingOccurrencesOfString:@"=" withString:@"%3d"] - stringByReplacingOccurrencesOfString:@"&" withString:@"%26"] - stringByReplacingOccurrencesOfString:@"+" withString:@"%2b"]; + NSString *escapedString = [str stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLQueryAllowedCharacterSet]; + + return [[[escapedString stringByReplacingOccurrencesOfString:@"=" withString:@"%3d"] stringByReplacingOccurrencesOfString:@"&" withString:@"%26"] stringByReplacingOccurrencesOfString:@"+" withString:@"%2b"]; } // Precondition: The feed URL should be valid