Skip to content

Commit

Permalink
Fix CLI cannot playing URLs without percent encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
lhc70000 committed Sep 1, 2018
1 parent 2e512c5 commit f1bd150
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
4 changes: 0 additions & 4 deletions iina-cli/main.swift
Expand Up @@ -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.")
Expand Down
2 changes: 1 addition & 1 deletion iina/AppDelegate.swift
Expand Up @@ -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
}
Expand Down

0 comments on commit f1bd150

Please sign in to comment.