Skip to content

Commit 62aa739

Browse files
andrasbacsaiclaude
andcommitted
Fix grep regex escaping for extended regex (ERE)
Replace preg_quote() with proper ERE escaping since grep -E uses extended regex syntax, not PHP/PCRE. This ensures special characters in registry URLs (dots, etc.) are properly escaped. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 5114157 commit 62aa739

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

app/Actions/Server/CleanupDocker.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,9 @@ private function buildImagePruneCommand($applicationImageRepos): string
8989
} else {
9090
// Build grep pattern to exclude application image repositories
9191
$excludePatterns = $applicationImageRepos->map(function ($repo) {
92-
// Escape special characters for grep basic regex
93-
return preg_quote($repo, '/');
92+
// Escape special characters for grep extended regex (ERE)
93+
// ERE special chars: . \ + * ? [ ^ ] $ ( ) { } |
94+
return preg_replace('/([.\\\\+*?\[\]^$(){}|])/', '\\\\$1', $repo);
9495
})->implode('|');
9596

9697
// Delete unused images that:

0 commit comments

Comments
 (0)