Skip to content

Commit

Permalink
Patch issue with ENV values that already quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
nicksagona committed Dec 21, 2023
1 parent 61011f0 commit 76a54a1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Controller/ApplicationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 . '"';
}

Expand Down
2 changes: 1 addition & 1 deletion src/Model/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 . '"';
}

Expand Down
6 changes: 3 additions & 3 deletions src/Model/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 . '"';
}

Expand Down

0 comments on commit 76a54a1

Please sign in to comment.