From 76a54a115ab2c00fe8eb76a8e74e1ca514d5d39d Mon Sep 17 00:00:00 2001 From: Nick Sagona Date: Thu, 21 Dec 2023 11:11:24 -0600 Subject: [PATCH] Patch issue with ENV values that already quotes --- src/Controller/ApplicationController.php | 2 +- src/Model/Application.php | 2 +- src/Model/Database.php | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Controller/ApplicationController.php b/src/Controller/ApplicationController.php index f85b9e6..cb49074 100644 --- a/src/Controller/ApplicationController.php +++ b/src/Controller/ApplicationController.php @@ -54,7 +54,7 @@ public function init(string $namespace, array $options = []): void $name = $this->console->prompt('What is the name of your app? [Pop] ', null, true); if ($name == '') { $name = 'Pop'; - } else if (str_contains($name, ' ')) { + } else if (str_contains($name, ' ') && !str_starts_with($name, '"') && !str_ends_with($name, '"')) { $name = '"' . $name . '"'; } diff --git a/src/Model/Application.php b/src/Model/Application.php index ef28ec8..29e22af 100644 --- a/src/Model/Application.php +++ b/src/Model/Application.php @@ -143,7 +143,7 @@ public function install( ); } - if (str_contains($name, ' ')) { + if (str_contains($name, ' ') && !str_starts_with($name, '"') && !str_ends_with($name, '"')) { $name = '"' . $name . '"'; } diff --git a/src/Model/Database.php b/src/Model/Database.php index 40753cc..b339ffa 100644 --- a/src/Model/Database.php +++ b/src/Model/Database.php @@ -198,13 +198,13 @@ public function configure(Console $console, string $location, string $database = if ($sqliteDb !== null) { $realDbName = $sqliteDb; } - if (str_contains($realDbName, ' ')) { + if (str_contains($realDbName, ' ') && !str_starts_with($realDbName, '"') && !str_ends_with($realDbName, '"')) { $realDbName = '"' . $realDbName . '"'; } - if (str_contains($dbUser, ' ')) { + if (str_contains($dbUser, ' ') && !str_starts_with($dbUser, '"') && !str_ends_with($dbUser, '"')) { $dbUser = '"' . $dbUser . '"'; } - if (str_contains($dbPass, ' ')) { + if (str_contains($dbPass, ' ') && !str_starts_with($dbPass, '"') && !str_ends_with($dbPass, '"')) { $dbPass = '"' . $dbPass . '"'; }