Skip to content

Commit 8d0d5cd

Browse files
committed
fix: allow dots in repo names for checkout validation
GitHub repos like interserver/webhooks.interserver.net contain dots but the checkoutBranch regex only allowed alphanumerics, underscores and hyphens. Update regex to also allow dots and forward slashes in owner/repo components.
1 parent 2c910da commit 8d0d5cd

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

scripts/github-code-review.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1049,7 +1049,7 @@ function checkoutBranch(string $repo, string $branch, string $checkoutPath): str
10491049
verbose_log("checkoutBranch: repo={$repo} branch={$branch} path={$checkoutPath}", 3);
10501050

10511051
// Validate repo format to prevent path traversal
1052-
if (!preg_match('/^[a-zA-Z0-9_-]+\/[a-zA-Z0-9_-]+$/', $repo)) {
1052+
if (!preg_match('/^[a-zA-Z0-9_.\/-]+\/[a-zA-Z0-9_.\/-]+$/', $repo)) {
10531053
verbose_log("checkoutBranch: invalid repo format: {$repo}", 1);
10541054
return 'invalid repo format';
10551055
}

tests/phpunit/unit/Cli/Renderer/TableRendererTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,8 @@ public function testSeverityIcons(): void
226226
$this->renderer->renderStatusItem($output, $status);
227227

228228
$content = $output->fetch();
229-
// Error severity should show red circle emoji
230-
$this->assertStringContainsString("\xE2\x9D\x94", $content);
229+
// Error severity should show red circle emoji (U+1F534)
230+
$this->assertStringContainsString("\xF0\x9F\x94\xB4", $content);
231231
}
232232

233233
public function testStatusIcons(): void

0 commit comments

Comments
 (0)