Przeglądaj źródła

config(qemu): support custom arguments with quotes

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

Fixes #6343
osy 3 dni temu
rodzic
commit
1cf095067f

+ 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)
                 let split = regex.matches(in: argString, options: [], range: range)
                 for match in split {
                 for match in split {
                     let matchRange = Range(match.range(at: 1), in: argString)!
                     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))
                 }
                 }
             }
             }
         }
         }