From 838d5ca9f76f074db87dc1250cc75793a526c61e Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Tue, 14 Jan 2025 21:22:26 -0800 Subject: [PATCH] Highly Complete: Fix crash on paths containing URL escapes In the event of local paths containing not just UTF-8 characters, but also un-decoded URL percent sequences, which will end up double encoded in the player, code which reverses percent encoding should later re-apply it. Apparently, this whole time, since the last code overhaul, the URL encoding was being stripped, then the file opener was converting these paths back into URLs without re-encoding, which didn't break until someone played an album in a folder containing a partially decoded UTF-8 sequence. Thanks, Zophar's Domain, and whoever ripped the Golden Sun GSF set for finding this bug! Signed-off-by: Christopher Snowhill --- Plugins/HighlyComplete/HighlyComplete/HCDecoder.mm | 1 + 1 file changed, 1 insertion(+) diff --git a/Plugins/HighlyComplete/HighlyComplete/HCDecoder.mm b/Plugins/HighlyComplete/HighlyComplete/HCDecoder.mm index 1bcaafe87..e6f5e0c8b 100644 --- a/Plugins/HighlyComplete/HighlyComplete/HCDecoder.mm +++ b/Plugins/HighlyComplete/HighlyComplete/HCDecoder.mm @@ -103,6 +103,7 @@ void *source_fopen(const char *path) { id source; if(![[psf_file_container instance] try_hint:[NSString stringWithUTF8String:path] source:&source]) { NSString *urlString = [NSString stringWithUTF8String:path]; + urlString = [urlString stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLFragmentAllowedCharacterSet]; NSURL *url = [NSURL URLWithDataRepresentation:[urlString dataUsingEncoding:NSUTF8StringEncoding] relativeToURL:nil]; id audioSourceClass = NSClassFromString(@"AudioSource");