Skip to content

Commit

Permalink
Plugin: Don't use bash in utils.exec
Browse files Browse the repository at this point in the history
  • Loading branch information
lhc70000 committed Nov 25, 2024
1 parent 245faa6 commit 3578fed
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions iina/JavascriptAPIUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,18 @@ class JavascriptAPIUtils: JavascriptAPI, JavascriptAPIUtilsExportable {
path = url.absoluteString
} else {
// assume it's a system command
path = "/bin/bash"
args.insert(file, at: 0)
args = ["-c", args.map {
$0.replacingOccurrences(of: " ", with: "\\ ")
.replacingOccurrences(of: "'", with: "\\'")
.replacingOccurrences(of: "\"", with: "\\\"")
}.joined(separator: " ")]
let useBash = false
if useBash {
path = "/bin/bash"
args.insert(file, at: 0)
args = ["-c", args.map {
$0.replacingOccurrences(of: " ", with: "\\ ")
.replacingOccurrences(of: "'", with: "\\'")
.replacingOccurrences(of: "\"", with: "\\\"")
}.joined(separator: " ")]
} else {
args.insert(file, at: 0)
}
}
} else {
// it should be an existing file
Expand Down

0 comments on commit 3578fed

Please sign in to comment.