1
0
mirror of https://github.com/nicoverbruggen/phpmon.git synced 2026-03-26 06:00:07 +01:00

🐛 Strip invalid characters from app names

This commit is contained in:
2026-02-06 14:53:39 +01:00
parent 485ac02cb5
commit faaa075e31

View File

@@ -32,10 +32,13 @@ class Application {
/// The full path to the application bundle (if found)
var path: String?
/// Characters that are unsafe for shell interpolation inside double quotes.
private static let unsafeCharacters: Set<Character> = ["\"", "\\", "`", "$", ";", "|", "&", "!", "#"]
/// Initializer. Used to detect a specific app of a specific type.
init(_ container: Container, _ name: String, _ type: AppType) {
self.container = container
self.name = name
self.name = String(name.filter { !Application.unsafeCharacters.contains($0) })
self.type = type
self.path = determinePath()
}