浏览代码

config(qemu): support custom arguments with quotes

Only strip quotes if the entire argument is wrapped in quotes.

Fixes #6343
osy 3 天之前
父节点
当前提交
1cf095067f
共有 1 个文件被更改,包括 5 次插入2 次删除
  1. 5 2
      Configuration/UTMQemuConfiguration+Arguments.swift

+ 5 - 2
Configuration/UTMQemuConfiguration+Arguments.swift

@@ -153,8 +153,11 @@ import Virtualization // for getting network interfaces
                 let split = regex.matches(in: argString, options: [], range: range)
                 for match in split {
                     let matchRange = Range(match.range(at: 1), in: argString)!
-                    let fragment = argString[matchRange]
-                    list.append(fragment.replacingOccurrences(of: "\"", with: ""))
+                    var fragment = argString[matchRange]
+                    if fragment.first == "\"" && fragment.last == "\"" {
+                        fragment = fragment.dropFirst().dropLast()
+                    }
+                    list.append(String(fragment))
                 }
             }
         }