From f1bd15003cb6d58576475c21c585f1bf4b7491ae Mon Sep 17 00:00:00 2001 From: Collider LI Date: Sun, 26 Aug 2018 17:44:14 +0800 Subject: [PATCH] Fix CLI cannot playing URLs without percent encoding --- iina-cli/main.swift | 4 ---- iina/AppDelegate.swift | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/iina-cli/main.swift b/iina-cli/main.swift index 3389b0b682..359e98ad07 100644 --- a/iina-cli/main.swift +++ b/iina-cli/main.swift @@ -19,11 +19,7 @@ execURL.resolveSymlinksInPath() let processInfo = ProcessInfo.processInfo -#if DEBUG -let iinaPath = execURL.deletingLastPathComponent().appendingPathComponent("IINA.app/Contents/MacOS/IINA").path -#else let iinaPath = execURL.deletingLastPathComponent().appendingPathComponent("IINA").path -#endif guard FileManager.default.fileExists(atPath: iinaPath) else { print("Cannot find IINA binary. This command line tool only works in IINA.app bundle.") diff --git a/iina/AppDelegate.swift b/iina/AppDelegate.swift index ad4c0df245..95ddfb8fdc 100644 --- a/iina/AppDelegate.swift +++ b/iina/AppDelegate.swift @@ -191,7 +191,7 @@ class AppDelegate: NSObject, NSApplicationDelegate { } else { let validFileURLs: [URL] = commandLineStatus.filenames.compactMap { filename in if Regex.url.matches(filename) { - return URL(string: filename) + return URL(string: filename.addingPercentEncoding(withAllowedCharacters: .urlAllowed) ?? filename) } else { return FileManager.default.fileExists(atPath: filename) ? URL(fileURLWithPath: filename) : nil }