From 689063b3054345986120170549f1b864be46ce0f Mon Sep 17 00:00:00 2001 From: Dzmitry Neviadomski Date: Wed, 3 Nov 2021 18:04:05 +0300 Subject: [PATCH] Fix deprecated NSURL to NSString conversion. (#2090) clang warning: ``` 'stringByReplacingPercentEscapesUsingEncoding:' is deprecated: first deprecated in macOS 10.11 - Use -stringByRemovingPercentEncoding instead, which always uses the recommended UTF-8 encoding. [-Wdeprecated-declarations] ``` Co-authored-by: Charles Kerr --- macosx/Controller.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/macosx/Controller.mm b/macosx/Controller.mm index 906881568..912d82213 100644 --- a/macosx/Controller.mm +++ b/macosx/Controller.mm @@ -983,7 +983,7 @@ static void removeKeRangerRansomware() NSString* message = [NSString stringWithFormat:NSLocalizedString(@"It appears that the file \"%@\" from %@ is not a torrent file.", "Download not a torrent -> message"), suggestedName, - [download.request.URL.absoluteString stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]; + [download.request.URL.absoluteString stringByRemovingPercentEncoding]]; NSAlert* alert = [[NSAlert alloc] init]; [alert addButtonWithTitle:NSLocalizedString(@"OK", "Download not a torrent -> button")]; @@ -1008,7 +1008,7 @@ static void removeKeRangerRansomware() { NSString* message = [NSString stringWithFormat:NSLocalizedString(@"The torrent could not be downloaded from %@: %@.", "Torrent download failed -> message"), - [download.request.URL.absoluteString stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding], + [download.request.URL.absoluteString stringByRemovingPercentEncoding], error.localizedDescription]; NSAlert* alert = [[NSAlert alloc] init];