fix: guard repository creation behind the adapter capability

Origin's createRepository() throws in utopia-php/vcs 5.2.0; asking
supportsRepositoryCreation() first turns that into a clear client
error instead of an uncaught provider exception.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Matej BačoandClaude Fable 5 committed 2026-08-19 15:05:56 +02:00
1 parent 6b78dd45e4
commit 194b8e5cef
1 file changed
+5
@@ -112,6 +112,11 @@ class Create extends Action
} else {
$providerInstallationId = $installation->getAttribute('providerInstallationId');
$vcs = $vcsFactory->fromInstallation($installation);
if (!$vcs->supportsRepositoryCreation()) {
throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'VCS provider does not support repository creation: ' . $provider);
}
$owner = !empty($providerNamespace) ? $providerNamespace : $vcs->getOwnerName($providerInstallationId);
try {